日期:2014-05-16 浏览次数:20424 次
<script>
function mov(li){
var ul = li.parentNode;
li.style.background="red";
for(var k=0;k<ul.childNodes.length;k++){
if(li!=ul.childNodes[k]){
ul.childNodes[k].style.background=""
}
}
}
</script>
<ul>
<li onmouseover=mov(this)>aa</li>
<li onmouseover=mov(this)>bb</li>
<li onmouseover=mov(this)>cc</li>
</ul>
<div>弹出层</div>
<!DOCTYPE html>
<html>
<body>
<script>
function mov1(){
var li=document.getElementById("a");
li.style.background="red";
var lio=document.getElementById("b");
lio.style.background="white";
var lioo=document.getElementById("c");
lioo.style.background="white";
}
function mov2(){
var li=document.getElementById("b");
li.style.background="red";
var lio=document.getElementById("a");
lio.style.background="white";
var lioo=document.getElementById("c");
lioo.style.background="white";
}
function mov3(){
var li=document.getElementById("c");
li.style.background="red";
var lio=document.getElementById("b");
lio.style.background="white";
var lioo=document.getElementById("a");
lioo.style.background="white";
}
</script>
<ul>
<li id="a" onmouseover=mov1()>aa</li>
<li id="b" onmouseover=mov2()>bb</li>
<li id="c" onmouseover=mov3()>cc</li>
</ul>
<div>弹出层</div>
</body>
</html>
<script>
function mov(li){
var ul = li.parentNode;
li.style.background="red";
var lis = ul.getElementsByTagName("li");
for(var k=0;k<lis.length;k++){
if(li!=lis[k]){
lis[k].style.background="white"
}
}
}
</script>
<ul>
<li onmouseover=mov(this)>aa</li>
<li onmouseover=mov(this)>bb</li>
<li onmouseover=mov(this)>cc</li>
</ul>
<div>弹出层</div>