ericnet
Programmer
- Mar 29, 2006
- 106
I have a function in my page that is triggered with an ‘onChange’ event handler from a tex box. If the user enters ‘0’ in the text box, when she/he wants to move to another element in the page an alert appears, and the cursor is focused again in the text box so that is modified. In IE works fine, but in Netscape 7.2 it doesn’ t, the alert appears only the first time the user moves to another element, after that the cursor isn’t focused in the text box and the alert doesn’ t appear anymore.
Here is the code sample:
How can I solve this problem in Netscape 7.2?
Thanks
Here is the code sample:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--//
function set_cursor() {
document.my_form.caliber_min.focus()
}
function check_field25() {
var cal_min = document.my_form.caliber_min.value
if (cal_min == "0") {
alert("You must enter a value greater than 0.")
document.my_form.caliber_min.focus()
return false;
}
return true;
}
// -->
</script>
</head>
<body onLoad="set_cursor()">
<form name="my_form">
<input name="caliber_min" type="text" maxlength="8" id="caliber_min" class="letter23" [b]onChange="return check_field25(this);"[/b] style="width: 50" /><br>
<input type="text" width="100">
</form>
</body>
</html>
How can I solve this problem in Netscape 7.2?
Thanks