Hi Elisabeth,
Very frustrating!!!
Another approach would be to check the value of the field each time a key is released, at least this way someone will not get confused when they try to focus on field 2 or 3 after clearing field 1 & in addition it might even work for you...
Code:
<html>
<head>
<title></title>
<script type="text/javascript">
function initForm1(form)
{
var f1 = form.field1.value;
if (!f1.match(/^(\s)*$/) )
{
form.field2.disabled = form.field3.disabled = false;
}
else
{
form.field2.disabled = form.field3.disabled = true;
form.field2.value = form.field3.value = "";
setTimeout("document.forms." + form.name + ".field1.blur(); document.forms." + form.name + ".field1.focus();");
}
return true;
}
</script>
</head>
<body onload="initForm1(document.forms.myForm);">
<form name="myForm">
Field1:
<input type=text name="field1" tabindex=3 onkeyup="initForm1(this.form);">
<br>
Field2:
<input type=text name="field2" tabindex=4 disabled="disabled">
<br>
Field3:
<input type=text name="field3" tabindex=5 disabled="disabled">
<br>
Field4:
<input type=text name="field4" tabindex=6>
</form>
</body>
</html>
HTH,
Chris