The onblur event

While onblur can be used for browser windows (as shown above), it’s more common for it to be used in forms. Scripts 9.15, 9.16, and 9.17 show the onblur handler being used to force the user to enter data into a field.

Script 9.15. This HTML creates the simple form.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Requiring an entry</title> <link type="text/css" rel="stylesheet" href="script08.css" /> <script type="text/javascript" src="script08.js"></script> </head> <body> <form action="#"> <h3> Email address: <input type="text" class="reqd" /><br /><br /> Name (optional): <input type="text" /> </h3> ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.