Home >Web Front-end >JS Tutorial >Bug description of getting the value of Button element in IE6 and IE7_javascript skills

Bug description of getting the value of Button element in IE6 and IE7_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:03:021262browse

The test code is as follows:

Copy code The code is as follows:


<script> <br>var btn = document.getElementsByTagName('button')[0]; <br>alert(btn.value); <br>alert(btn. getAttribute('value')); <br></script>

IE6/7:

IE8/9/10/Firefox/Safari/Chrome/Opera:

i.e.:

In IE6/7, innerHTML is returned, which is an implementation error.

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