Home > Web Front-end > JS Tutorial > Get the code for the text of the option selected in the following box under firefox_javascript skills

Get the code for the text of the option selected in the following box under firefox_javascript skills

WBOY
Release: 2016-05-16 18:24:26
Original
1034 people have browsed it

Knowledge points:
0. Why innerText? Because of security issues
1. Extend attributes for the firefox dom model
2. The currentStyle attribute can obtain the actual style status
3. When IE implements innerText, it considers the display method. If it is a block, a newline is added
4. Why not use textContent? Because textContent does not take into account the display mode of the element, it is not fully compatible with IE.
Code: The test passed under IE6, 7, 8 and Firefox 2, 3.


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

Of course, if you target the drop-down alone box, you don’t need to rewrite innerText, you can also use the following code to achieve it. InnerText is rewritten to be compatible with other HTML elements except drop-down boxes.

[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute ]
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