About nextSibling_html/css_WEB-ITnose in IE

WBOY
Release: 2016-06-24 11:43:15
Original
1319 people have browsed it

    <script>        var shq = {}        shq.cmenu = function (e) {            var e = window.event ? window.event.srcElement : e.target;            if (/a/i.test(e.tagName)) {                alert(e.parentNode.nextSibling.nodeType); // 3  text                e.parentNode.nextSibling.innerHTML = e.innerHTML;                e.blur();            }        }    </script>    <div id="div1" onclick="shq.cmenu(event)">        <a href="#">特色</a>    </div>    <div id="div2"></div>
Copy after login

System environment: win8, ie11

Problem: nextSibling obtains the next node at the same level as the current node, but failed.

Process description: When clicking [Features], the innerHtml of div2 did not become [Features]
During debugging, it was found that e.parentNode.nextSibling is not the next div but #text, and nodetype is equal to 3.

Personal conclusion: I don’t know if it’s right or not, but this is the result now.

div1.nextSibling.nextSibling is div2.

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