Dict.CN 在线词典, 英语学习, 在线翻译 ------------- MyGitee My腾云code

Happy_EveryDay

可以平凡 不可以平庸 无爱则无忧,无欲则无求,无怒而无敌,无怨才是佛。所有烦恼,都是放不下的执著 开源技群 328035181 MyGitee

firefox与IE的nextSibling

提取dom邻节点(兄弟节点)

<h2  onclick="show(this)">

  <ul>

  <li></li>

  <li></li>  

  </ul>

</h2>

function show(ob) {
    var index= ob.nextSibling.nodeType;
    var reObj;
    if (index== 3) {    //firefox
        reObj= ob.nextSibling.nextSibling;
    }
    else {     //IE
        reObj= ob.nextSibling;
    }
    if (reObj.style.display == '' || reObj.style.display != 'none')
        reObj.style.display = 'none';
    else
        reObj.style.display = '';
}

posted on 2010-01-26 16:57  cn2025  阅读(231)  评论(0)    收藏  举报

导航