|
<pre>function totalamountdue() {
var inputs = document.getElementsByTagName("INPUT");
var runningTotal = 0;
for (i = 0; i &lt; inputs.length; i++) {
if (inputs[i].id == "total") {
inputs[i].value = runningTotal / 100;
var a = inputs[i].value.split(".");
if (!a[1]) {inputs[i].value += ".00"}
else if (a[1].indexOf("0") != 0 &amp;&amp; a[1] &lt; 10) { inputs[i].value += "0" }
}
if (inputs[i].id.indexOf("Amount") == 0) {
if (/^[1-9][0-9]{0,2}(,[0-9]{3})*(\.[0-9]{2})?$/.test(inputs[i].value)) {
runningTotal += +inputs[i].value * 100;
} else {
if (inputs[i].value == "THIS IS A BAD VALUE") { inputs[i].value = ""; }
if (inputs[i].value) { inputs[i].value = "THIS IS A BAD VALUE"; }
}
}
}
} <></pre>
-- Modified Friday, February 26, 2010 1:35 AM
|
|
|
|
|
Dave, I could hug you...or just give you five! Thank you and the previous person, Jason for all of your efforts. I hate to ask for help, but there was no way I was going to get this one. Sometimes I come up with these ambitious ideas but with no way to implement them.
Thank you very much,
Evan Einhorn
|
|
|
|
|
|
function totalamountdue() {
var inputs = document.getElementsByTagName("INPUT");
var runningTotal = 0;
for (i = 0; i < inputs.length; i++) {
if (inputs[i].id == "total") {
inputs[i].value = runningTotal / 100;
var a = inputs[i].value.split(".");
if (!a[1]) {inputs[i].value += ".00"}
else if (a[1].indexOf("0") != 0 && a[1] < 10) { inputs[i].value += "0" }
}
if (inputs[i].id.indexOf("Amount") == 0) {
if (/^[1-9][0-9]{0,2}(,[0-9]{3})*(\.[0-9]{2})?$/.test(inputs[i].value)) {
runningTotal += +inputs[i].value * 100;
} else {
if (inputs[i].value == "THIS IS A BAD VALUE") { inputs[i].value = ""; }
if (inputs[i].value) { inputs[i].value = "THIS IS A BAD VALUE"; }
}
}
}
}
|
|
|
|
|
I know you have already been given a solution to this, but I just thought I give you an important tip. This didn't work because you are declaring and adding variables with a lowercase 'a' in amount, but assigning the values to an uppercase Amount. This makes them different variables. Amount != amount. JavaScript is case sensitive. Words fade as the meanings change, but somehow, it don't bother me.
|
|
|
|
|
Hi Boro_Bob, I really appreciate the information. Last August I lost my job and then decided that I would do my own thing. I knew I needed a website so I started working on it. I knew absolutely nothing about HTML. Little by little I have learned along the way and I borrowed lots of code I found on the net but only employed it if I could get it to work. Instructions varied so if it worked great if not I moved on. Javascript...not a clue. But again I scoured the internet to make my column add up and tried many different iterations. I should have known what you said to be true about the code being case sensitive...as it is true for HTML. During the course of building my website I had decided to capitalize the first letter of the file names when I was done editing so I could keep track of what was done. Lesson learned, never capitalize the "I" in index.html or it will give you a 404 Error code and the Home page won't work.LOL. My web page has been about scope creep, every time I get something to work I then think of something to make it better. For instance, the columns adding up now works great...my next idea was to have drop downs with the 3 or so varying amounts I charge for my online classes. You know I had to try it but since I don't know squat about JS I gave up my idea.
Again I want to say "thank you" for explaining that JS was case sensitive. I tried like hell to figure it out on my own and that never dawned on me.
Evan Einhorn
www.AHTCSonline.com
|
|
|
|
|
No problem. Good luck with your site. Words fade as the meanings change, but somehow, it don't bother me.
|
|
|
|
|
Hey guys, I am wondering if anyone knows some javascript code to lockup a web page for a given amount of time. I am doing some testing on my cell phone. Whether it be by a bug in some code or using an infinite loop of calculations to "lockup" the memory, etc. I don't know javascript that well to create a command loop...
I did find this link[^] but couldn't get it working.
I hope someone can shed some light. Thanks in advance.
|
|
|
|
|
I am making a website in hindi using ASP ,but whenever i want to retrieve data dynamically from MS Access database,it either shows ?????? or some junk value or some awkward characters of other language..
I want to know what all i can do to make it run..
|
|
|
|
|
Hi Jyoti,
Have you set the globalization properties in your web.config like so?
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8" />
There is an article here[^] that might assist you.
Cheers,
Daniel
|
|
|
|
|
I have a web site that works fine on a Win 2003 server with IIS 6 and I am trying to move it to a server with Win 2008 and IIS 7.5. I am using Request.ServerVariables("LOGON_USER") to get the user who is currently logged in to the machine and in IIS 6 I have the "Integrated Authentication" option checked and this works fine. I cannot figure out how to get this to work on IIS 7.5. I have tried enabling Windows Authentication and it still brings up a password box. I want it to work the way it currently does and just open the page. I have the site added to my trusted sites in IE. I have also verified that "Automatic logon with current user name and password" is checked in the "Custom level..." settings for Trusted sites and Local intranet. Could it be something with the IUSR account on the Win 2008 machine?
I have been searching with Google for a couple hours now, can anyone point me in the right direction? Thank you.The woods are lovely, dark, and deep
But I have promises to keep
and lines to code before I sleep,
and lines to code before I sleep...
|
|
|
|
|
I have asp pages, and using vbscript. Does anyone know how I can retrieve the session variables using a session id? Or any other way of retrieving the session object from another session?
My problem is as follows:
I have a payment page where someone gives me credit card information etc.
I have to redirect them to a page on the bank's website for authentication. When they've authenticated themselves, the bank sends them back to one of my pages. Then I'm able to process the credit card transaction as normal. (This is part of a new security feature some banks use)
I use session variables to store the users details. Most of the time this works fine, but some devices, mostly mobile devices, create a new session when they are redirected back to me, then I'm unable to access the session variables.
I don't want to store credit card information in my database nor in a cookie, so I have use session variables. I can set the querystring that will be returned to me, I thought of saving the session id in the query string.
I've been banging my hesd against the wall for days now, still not closer to a solution.
|
|
|
|
|
Hi,
I recently made an application which was just a browser control in a winform app. It loaded a local file containing the necessary javascript code to load google earth globe on a document.
Document source:
http://code.google.com/apis/ajax/playground/#hello,_earth[^]
Everything worked like a charm until.
Recently google launched chrome frame whereby now inorder to run google earth on IE i have to install google frame. Ahan .. ok i did google earth started working again on IE np theres.
But using the .net webbrowser component it no longer renders the globe window. The plugin isn't loaded(the obvious case) once i load the document. I have added the meta tag as specified by google. but no luck.
I see that chrome launches as i navigate to earth page on a standalone IE browser. but it doesnot on my .net control navigation...
Any help Please
|
|
|
|
|
Hi there,
I'm using ASP.NET to send newsletter to some email addresses. the news letter is an html file with an image in its background. but the image cannot be displayed in Outlook 2003,2007.
Is it completely impossible to displaythe background in Office Outlook?
if not, what's the solution?
|
|
|
|
|
Do not post the same question to multiple forums
You have been around long enough to know this I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Difficulty using Ordered Lists in HTML tables
I can't figure out how to use Ordered Lists inside HTML tables.
The following is an Ordered List Outside of any HTML table:
1. Decimal type
2. Tea
3. Coca Cola
The Ordered List above is perfect, i.e., exactly what I want, when the list is outside of a table.
I can't figure out a way to keep the Ordered List numbering working (as shown above) when the Ordered List appears inside a table, as shown in the pdf file at this url:
"http://www.theadhdsolution.net/publicmisc/Difficulty%20using%20Ordered%20Lists%20in%20HTML%20tables.docx.pdf[^]"
I need the numbering to continue from the Left cell in the first row (in the table in the pdf) to the Left cell in the second row (in the pdf), to the left cell in the 3d row (in the pdf).
<html>
<head>
<title>My HTML application</title>
<HTA:APPLICATION
APPLICATIONNAME="My HTML application"
ID="MyHTMLapplication"
VERSION="1.0"/>
</style>
</head>
<script language="VBScript">
Sub Window_OnLoad
'This method will be called when the application loads
'Add your code here
End Sub
</script>
<font size ="4"><b><u>My Outline-Numbering Wish List</b></u>
<br>
<ol>
<li>Decimal type</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
<br>
<br>
<table cellspacing=1 cellpadding=3 bgcolor="black">
<tr>
<td bgcolor="white">
<ol><li>Decimal type</li>
</td>
<td bgcolor="white">
Right Column
</td>
</tr></ol>
<td bgcolor="white">
<ol><li>Tea<br><-- I wish that that the "1" could be replaced with a "2"</li>
</td>
<td bgcolor="white">
Right Column
</td>
</tr></ol>
<td bgcolor="white">
<ol><li>Coca Cola<br><-- I wish that that the "1" could be replaced with a "3"</li>
</td>
<td bgcolor="white">
Right Column
</td>
</tr></ol>
</table>
<br>
<table cellspacing=1 cellpadding=3 bgcolor="black">
<tr>
<td bgcolor="white">
<ol>
<li>First One</li>
</td>
<td bgcolor="white">
<li><-- I wish that that were a "2"</li>
</td>
</tr>
<tr>
<td bgcolor="white">
<li><-- I wish that that were a "3"</li>
</td>
<td bgcolor="white">
<li>Whoops. One too many</li>
</td>
</tr>
</table></ol>
</body>
</html>
|
|
|
|
|
You can't split the list between cells and rows, put it in one cell I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for the reply. What book did you read that said that? Do you recall what page the info was on?
My problem is that I need the list numbering to work across cells, as opposed to being limited to working only inside one cell.
If it becomes clear to me that the < ol > < li >item< /li > approach won't work, then I'll have to hunt around for some other solution. Do you have any suggestions?
Anyway, thanks for your time and effort.
Barry
|
|
|
|
|
It wasn't in a book, it's in the specification from W3C. You can use OL/LI but you can't use it with a table as you would like.
As suggested you can use CSS to apply the formating like a table. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thank you for replying again. I need a little more info in order to be able to take advantage of your insight.
You said: "As suggested you can use CSS to apply the formating like a table." In which "specification from W3C" can I find some information about how to use CSS "to apply the formating like a table"? Can you be a little more specific? The W3c specifications are enormous. I'm trying to read it now, coincidentally, but because I am so ignorant at this point, that your telling me that the solution to my problem "is in the W3C specifications" feels like someone telling me that the solution is in the Encyclopedia Brittanica. (You had no way of knowing that I am so ignorant, and I apologize for wasting your time.) I have no idea where to look. Could you possibly tell me on what page of the W3c specifications I'll find the answer? (and maybe even say a word or two about how the stuff on that page will help?)
I really appreciate this help. Thank you again.
Barry
|
|
|
|
|
I did not say to look in the specs for how to use CSS. I said the reason you could not use ol/li as you tried was covered in the specification which describe how browsers are supposed to render elements. If you want a specific reference, sorry I'm not spending the time to look for it. Researching yourself will help you learn.
If you want to learn CSS there are many examples and tutorials available and easy to find I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I don't think you will be able to do that with
tables but css can give you the disired results.
Here is an example ...
<pre>
<html>
<head>
<title>My HTML application</title>
<HTA:APPLICATION
APPLICATIONNAME="My HTML application"
ID="MyHTMLapplication"
VERSION="1.0"/>
<style>
div{
width:280px;
}
ol{
padding: 0;
margin-top: 0;
margin-bottom: 0;
border-top: 1px solid black;
border-left: 1px solid black;
border-right: 1px solid black;
}
ol li{
border-bottom: 1px solid black;
color:red;
}
ol li span{
border-right: 1px solid black;
width:120px
}
</style>
<script language="VBScript">
Sub Window_OnLoad
End Sub
</script></head>
<body>
<font size ="4"><b><u>My Outline-Numbering Wish List</u></b>
<br>
<div>
<ol>
<li> <span> Decimal type </span>Right Column </li>
<li> <span> Tea type <br> it says 2</span>Right Column </li>
<li> <span>Coca Cola type <br> it says 3</span>Right Column </li>
</ol>
</div>
</body>
</html>
</pre>
|
|
|
|
|
Thank you. Much appreciated. Very clever.
Barry
|
|
|
|
|
This may not be the correct forum but I can't find a better place to ask this!
I'm writing a custom IMAP client to perform some automatic processing of emails. The problem I'm having is that when I create a mailbox in code, it's created fine - I can move messages to it etc in my code but when I view the account on another email client the mailbox is hidden.
How do I stop this, or is there a flag or something I need to apply to the mailbox?
[Edit] A little further investigation reveals if I use a string literal when making the folder name there is no problem. If I use a string constant however - the folder is created hidden... wierd! [/Edit]
|
|
|
|
|
In case anyone comes across this in future, it turns out that depending on the client viewing (or it's settings) you have to issue a subscribe command after creation so the user is auto-subscribed to the new folder - pretty obvious now but took some tracking down! Dave
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|