[an error occurred while processing this directive]
There are 3 events which I find particularly useful when working in a form.
FOCUS means the object where the cursor is currently blinking. OnFocus events occur whenever the cursor enters that textbox or textarea. It doesn't matter whether the user placed the cursor there with the mouse or with the TAB key. As soon as the cursor enters a box, an OnFocus event attached to that box wil l occur.
<FORM> <INPUT TYPE=TEXT SIZE=20 onFocus="window.status='Hi there';return true"> </FORM> |
BLUR is the opposite of focus. Therefore an onBlur event will occur whenever a text object loses focus. Here is the same example again, but the alert will occur when you try to leave the box.
<FORM> <INPUT TYPE=TEXT SIZE=20 onBlur="window.status='Bye now';return true"> </FORM> |
Try moving the focus from the second example to the first, and the message will appear twice, once because you left the box with an onBlur event, and once because you entered a box with an onFocus event.
More Events |