Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

javascrip中如何实现鼠标移动显示/隐藏<div>的导航功能?

纯新手,写了如下代码

<script type="text/javascript">        
        window.onload=function(){
            var yuansu=document.getElementsByTagName("p")
            for(i=0;i<yuansu.length;i++){
                yuansu[i].onmouseover=function(){
                    document.getElementById("i").style.visibility="visible";
                }
                yuansu[i].onmouseout=function(){
                    document.getElementById("i").style.visibility="hidden";
                }
            }
        }
</script>

想在鼠标停在某一个<p>上时,使对应的无父子兄弟关系的<div>显示出来,而其他无关的<div>则隐藏,显然我的代码无法实现,那么如何实现呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...