M
Michael
can anyone explain why I get an endless loop of alerts (alert - hit enter -
alert - hit enter etc) from the following script/page?
It works ok in IE, and works ok in FF if I use the mouse to click the "ok",
but not if I use the enter key....
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function updateForm(dom)
{
var qty = document.getElementById(dom).value;
if (qty != "")
if (qty == 0 || qty > 5)
{
alert ("The number may not be 0 and not bigger than 5!");
document.getElementById(dom).select();
document.getElementById(dom).focus();
}
}
</script>
</head>
<body>
<form action="#">
Enter a number:
<!-- I changed value="0" to value="" -->
<td> <input type = "text" name = "qty1" id = "qty1" value="" size="15"
onkeyup = "updateForm('qty1');" /> </td>
</form>
</body>
</html>
regards
Michael
alert - hit enter etc) from the following script/page?
It works ok in IE, and works ok in FF if I use the mouse to click the "ok",
but not if I use the enter key....
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function updateForm(dom)
{
var qty = document.getElementById(dom).value;
if (qty != "")
if (qty == 0 || qty > 5)
{
alert ("The number may not be 0 and not bigger than 5!");
document.getElementById(dom).select();
document.getElementById(dom).focus();
}
}
</script>
</head>
<body>
<form action="#">
Enter a number:
<!-- I changed value="0" to value="" -->
<td> <input type = "text" name = "qty1" id = "qty1" value="" size="15"
onkeyup = "updateForm('qty1');" /> </td>
</form>
</body>
</html>
regards
Michael