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

Differences in performance of option elements in javascript browsers_form effects

WBOY
Release: 2016-05-16 18:08:24
Original
1052 people have browsed it

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:
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template