Home  >  Article  >  Web Front-end  >  Differences in performance of option elements in javascript browsers_form effects

Differences in performance of option elements in javascript browsers_form effects

WBOY
WBOYOriginal
2016-05-16 18:08:241012browse

1. There are no events (such as click, mouseover) in IE6/7/8/9, but there are in Firefox/Safari/Chrome/Opera.

Copy code The code is as follows:



Example:



2, click option, get the event source target through srcElement is select in IE , Firefox/Safari/Chrome/Opera are options.
Copy code The code is as follows:


<script> <br>document.getElementById('s2').onclick = function(e){ <br>var evt = window.event || e; <br>var target = evt.srcElement || evt.target; <br>alert(target.tagName); <br>} <br> </script>

Example:




3. Adding the title attribute to the option element to implement the tips function is invalid under IE6. The code is as follows:



Example:
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