The onBlur Event

If an item can be focused upon, the focus can also be blurred, which simply means the focus is lost on an item. The onBlur Event Handler allows an alert to let a user know that he or she is leaving an input box. Here is the code to do that:

HTML file: Displayed by browser:
<body>

<FORM>
<INPUT TYPE="text" SIZE="40"
onBlur="alert('You are leaving this input box - Are you sure you want to do that?');">
</FORM>

</body>

The user must click into the input box, and then off that box, to trigger the alert pop up window.

BackTable of ContentsNext