Click to See Complete Forum and Search --> : Oh How Annoying Values sent as string?


Nicodemas
03-10-2003, 06:05 AM
Why OH Why doesn't this work...all I want it to do is add three to the current value of the text box.
I tried using "eval" but that doesn't work either. Trouble is it's parsing them together as if they were strings....


<HTML>
<HEAD>
<SCRIPT LANGUAGE="Javascript">
function doChange()
{
var num = myForm.length; // counts the number of form objects starting from zero. num= 7
for(i=0;i<num-2;i++)
{
myForm.elements[i].value+=3
}

}

</SCRIPT>
</HEAD>
<BODY BGCOLOR="#0000ff" TEXT="#FFFFFF">
<FORM NAME="myForm" STYLE="margin-left:25px">
myText 1: <INPUT TYPE="text" NAME="myText0" value="0"><P>
myText 2: <INPUT TYPE="text" NAME="myText1" value="1"><P>
myText 3: <INPUT TYPE="text" NAME="myText2" value="2"><P>
myText 4: <INPUT TYPE="text" NAME="myText3" value="3"><P>
myText 5: <INPUT TYPE="text" NAME="myText4" value="4"><P>
myText 6: <INPUT TYPE="text" NAME="myText5" value="5"><P>
<INPUT TYPE="button" VALUE="Start" onClick="doChange()"> <INPUT TYPE="Reset" VALUE="Reset">
</FORM>
</BODY>
</HTML>

Nicodemas
03-10-2003, 07:02 AM
thanks Dave!

So Number() converts a string into a number, I'll have to keep that in mind.