JScript within an asp page question


D

Damian Greene

I know this is an asp newsgroup, and I've gotten help from
the group on several asp related questions, but I was
hoping someone could answer a JScript question

I wrote this script that was working, now it isn't. What
it does is simply place the value of a checkbox, when
clicked, into a text field and then sum the total of any
checked boxes into another text box. Unchecking the check
box will subtract the total. The checkboxes call two
functions with the OnClick event handler

OnClick="addNumbers(); setTextField(this.form)"

where TextField is the name of the field I want the value
of the checkbox to go. The setTextField Function works
fine. All of a sudden the addnumbers is giving a NaN in
the total box instead of summing it up. Here is the
addnumbers Script

<!--
function addNumbers()
{
var test = 0;
test = parseFloat(document.forms[0].Field77.value);


var num1 = 0;
num1 = parseFloat(document.forms[0].Field78.value);


var num2 = 0;
num2 = parseFloat(document.forms[0].Field79.value);


var num3 = 0;
num3 = parseFloat(document.forms[0].Field80.value);


var num4 = 0;
num4 = parseFloat(document.forms[0].Field81.value);


var num5 = 0;
num5 = parseFloat(document.forms[0].Field82.value);


var overdue = 0;
overdue = parseFloat(document.forms[0].Field83.value);


var qtotal = (test + num1 + num2 + num3 + num4 + num5
+ overdue);
document.forms[0].charge_total.value = qtotal;

}
// End -->
</script>

Can anyone see why this would return a NaN, when the
function is called when a checkbox is clicked? Am I
missing a semicolon or something? Thanks
 
Ad

Advertisements

E

Evertjan.

Damian Greene wrote on 01 jul 2003 in
microsoft.public.inetserver.asp.general:
I know this is an asp newsgroup, and I've gotten help from
the group on several asp related questions, but I was
hoping someone could answer a JScript question

This asp group will answer questions about
both serverside(!) vbscript AND j(ava)script.

however for your clearly clientside question
I would suggest you ask this in:

microsoft.public.scripting.jscript

or

comp.lang.javascript
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top