Hello Chris!!
I think I know why we are having problems. When I tried your script, I first used the tabulator on field1 and then the cursor went to field4. After that I focused on field1, entered a value and used the tab, it went to field2 and using the tab from field2 the cursor went to field1 again!!.
Now if you enter a value the first time in field1 it works fine.
Anyway, here is my code:
<html>
<head>
<title></title>
<script type="text/javascript">
function disableFields()
{
document.forms[0].field2.disabled=false;
document.forms[0].field3.disabled=false;
}
function initForm1(form)
{
var f1=form.field1.value;
if (!f1.match(/^(\s)*$/) )
{
form.field2.disabled=false;
form.field3.disabled=false;
setTimeout("document.forms." + form.name + ".field2.focus()", 1);
}
else
{
form.field2.disabled=true;
form.field2.value="";
form.field3.disabled=true;
form.field3.value="";
}
}
</script>
</head>
<body onLoad=disableFields()>
<form name="myForm">
Field1:
<input type=text name="field1" tabindex=3 onBlur="initForm1(this.form);"
<br>
Field2:
<input type=text name="field2" tabindex=4 >
<br>
Field3:
<input type=text name="field3" tabindex=5 >
<br>
Field4:
<input type=text name="field4" tabindex=6>
</form>
</body>
</html>
|