PDA

View Full Version : jump to next text box...urgent help..


help
02-09-2004, 01:21 PM
Can anyone please let me know why this coding is not working..

function nextBox(phone, maxlength) {
var char_num = 0
if (phone == "phone1"){
char_num = document.myform.phone1.value.length
if (char_num >= maxlength){
document.myform.phone2.focus()
}
}
else if(phone == "phone2") {
char_num = document.myform.phone2.value.length
if (char_num >= maxlength){
document.myform.phone3.focus()
}
}
}


//End-->

<table border=2>
<tr>
<td><font face="arial" size="2" color="black"><b>Student ID</b></td>
<td><input type="text" size="3" name="phone1" value="" maxlength="3" onkeyup="nextbox('phone1',3)"></td>
<td><input type="text" size="2" name="phone2" value="" maxlength="3" onkeyup="nextbox('phone2',3)"></td>
<td><input type="text" size="4" name="phone3" value="" maxlength="4"></td>
</tr>
</table><br /><br />


Thanks.

mat16k
02-11-2004, 05:28 PM
Is this the entire pages code??
it does not declare any variables and you point to stuff that isn't there.

If complete try looking through the tutorials at http://www.pageresource.com/jscript/index4.htm
They come in very useful.