Form Field Event Handlers
The W3C has also added a number of scripting event handlers to work with many of the form elements to facilitate the execution of script code while a user fills out a form. These event handlers include
onfocus
onblur
onselect
onchange
Two of the most widely usable event handlers are onfocus and onblur. Recall that a field receives focus when you've tabbed to it or clicked it to make it active. At the moment a field receives focus, you can choose to execute a script by setting the onfocus attribute of the corresponding form field element equal to the name of a script defined in the document.
When you tab out of a form field that has focus, the field is said to blur. You can execute a script when a blur event occurs by setting ...
Get Platinum Edition Using XHTML™, XML, and Java™ 2 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.