Home >Web Front-end >JS Tutorial >Form Element Events_javascript skills

Form Element Events_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:49:501126browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn