Home >Web Front-end >JS Tutorial >Form Element Events_javascript skills
Attribute value description
onchange script executes the script when the element changes
onsubmit script executes the script when the form is submitted
onreset script executes the script when the form is reset
onselect script executes when the element is selected Script
onblur script executes the script when the element loses focus
onfocus script executes the script when the element gains focus
The w3c standard describes it this way.
However, I found that IE can execute it (but if you test onfocus under Safari, do not use alert(), it will pop up infinitely.), but other browsers cannot implement it. IE has always been a disobedient master and is privatistic...but sometimes it is really useful to use the above events in non-form elements. You can set the tabindex attribute on non-form elements. Let other browser non-form elements respond to events. This should be considered a hack (it does not meet the standards, but it is also a helpless move). But it’s really useful