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.
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.