B
Ben Dong
Can someone help me understand why the focus() method in the following code
snippet does not do what is expected; which is to reposition the cursor back
to the same element after the alert() message has been displayed:
<head>
....
<script>
function checkABC(element) {
alert("Hey, you changed me to " + element.value + "!!");
element.focus();
return true;
}
</script>
....
</head>
....
....
....
<form>
<table>
....
<tr>
<td valign="middle" bgcolor="#DDCCDD">
<input type="text" name="ABC" value="12345" size="5"
onChange="checkABC(this);" /><br />
....
</td>
....
</tr>
....
</table>
</form>
Thanks, Ben
snippet does not do what is expected; which is to reposition the cursor back
to the same element after the alert() message has been displayed:
<head>
....
<script>
function checkABC(element) {
alert("Hey, you changed me to " + element.value + "!!");
element.focus();
return true;
}
</script>
....
</head>
....
....
....
<form>
<table>
....
<tr>
<td valign="middle" bgcolor="#DDCCDD">
<input type="text" name="ABC" value="12345" size="5"
onChange="checkABC(this);" /><br />
....
</td>
....
</tr>
....
</table>
</form>
Thanks, Ben