...

View Full Version : Radios & JavaScript...HELP!



Gigadestroyer
07-26-2002, 06:32 PM
Will somebody please tell me what I'm doing wrong in the following script? I just can't figure it out!

<HTML><HEAD>
<SCRIPT>
function Score() {
var tot = 0;
tot += (document.order.quest1.value);
tot += (document.order.quest2.value);
tot += (document.order.quest3.value);
document.order.totscore.value = tot;
}
</SCRIPT></HEAD>
<BODY BGCOLOR=#000000 TEXT=#FFFFFF>
<FORM NAME="order">
<TABLE CELLPADDING=3 CELLSPACING=2 BGCOLOR=#000000>
<TR>
<TD>Question #1<BR>
<INPUT TYPE="Radio" NAME="quest1" VALUE="1">&nbsp;Answer 1<BR>
<INPUT TYPE="Radio" NAME="quest1" VALUE="2">&nbsp;Answer 2<BR>
<INPUT TYPE="Radio" NAME="quest1" VALUE="3">&nbsp;Answer 3
</TD>
<TD>Question #2<BR>
<INPUT TYPE="Radio" NAME="quest2" VALUE="1">&nbsp;Answer 1<BR>
<INPUT TYPE="Radio" NAME="quest2" VALUE="2">&nbsp;Answer 2<BR>
<INPUT TYPE="Radio" NAME="quest2" VALUE="3">&nbsp;Answer 3
</TD>
<TD>Question #3<BR>
<INPUT TYPE="Radio" NAME="quest3" VALUE="1">&nbsp;Answer 1<BR>
<INPUT TYPE="Radio" NAME="quest3" VALUE="2">&nbsp;Answer 2<BR>
<INPUT TYPE="Radio" NAME="quest3" VALUE="3">&nbsp;Answer 3
</TD>
</TR>
<TR>
<TD COLSPAN=3>
<CENTER>
<INPUT TYPE="Button" NAME="SubQuest" VALUE="What's Your Score?" OnClick="javascript:Score();">
</CENTER>
</TD>
</TR>
<TR>
<TD COLSPAN=3>
<CENTER><INPUT TYPE="Text" NAME="totscore"></CENTER>
</TD>
</TR>
</TABLE></FORM>
</BODY></HTML>

RadarBob
07-26-2002, 07:07 PM
I get "NaN" in the score box when I run your page.

NaN = "Not a Number".

Not sure exactly how to fix it - sorry :o

Gigadestroyer
07-26-2002, 07:14 PM
:mad: Okay, I took off the quotes exactly like you said and it still gives me NaN (which BTW I do know what it means) and I don't get it. WTF? This is very manacing.... :mad:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum