S
Stefan Mueller
In my example the focus should only jump to textbox2 if you press the tab
key and if '11' is in textbox1. That works fine.
However if you enter e.g. '12' in textbox1 and click on 'Link', Mozilla
shows the alert 'Wrong numer' but also jumps to 'www.google.com'.
Opera and IE don't do that what's in my opinion the correct behavior.
<html>
<body>
<script type = 'text/javascript'>
function test(object) {
if (object.value == 11) {
return (true);
}
else {
alert("Wrong number");
return (false);
}
}
</script>
<form name = "my_form" action = "" method = "post" accept-charset =
"iso-8859-1">
<table id = "my_table" border = "1">
<tr>
<td>
<input type = "text" name = "my_textbox1" onBlur = 'if
(!test(document.my_form.my_textbox1))
{setTimeout("document.my_form.my_textbox1.focus();", 1);}'>
<input type = "text" name = "my_textbox2">
<a href="http://www.google.com">Link</a>
</td>
</tr>
</table>
</form>
</body>
</html>
How can I prevent Mozilla from jumping to 'www.google.com' if the value in
the input box is wrong?
Stefan
key and if '11' is in textbox1. That works fine.
However if you enter e.g. '12' in textbox1 and click on 'Link', Mozilla
shows the alert 'Wrong numer' but also jumps to 'www.google.com'.
Opera and IE don't do that what's in my opinion the correct behavior.
<html>
<body>
<script type = 'text/javascript'>
function test(object) {
if (object.value == 11) {
return (true);
}
else {
alert("Wrong number");
return (false);
}
}
</script>
<form name = "my_form" action = "" method = "post" accept-charset =
"iso-8859-1">
<table id = "my_table" border = "1">
<tr>
<td>
<input type = "text" name = "my_textbox1" onBlur = 'if
(!test(document.my_form.my_textbox1))
{setTimeout("document.my_form.my_textbox1.focus();", 1);}'>
<input type = "text" name = "my_textbox2">
<a href="http://www.google.com">Link</a>
</td>
</tr>
</table>
</form>
</body>
</html>
How can I prevent Mozilla from jumping to 'www.google.com' if the value in
the input box is wrong?
Stefan