1 回答
TA贡献1836条经验 获得超3个赞
<div>
<div id="div1" style="height: 100px;display: inline-block;width: 100px; border: 1px solid #000;"></div>
<div id="div2" style="height: 100px;display: inline-block;width: 100px; border: 1px solid #000;"></div>
</div>
var oDov1 = document.getElementById('div1');
var oDov2 = document.getElementById('div2');
oDov1.onmouseover = function(){
this.style.background = "red";
oDov2.style.background = "";
}
oDov2.onmouseover = function(){
this.style.background = "green";
oDov1.style.background = "";
}
添加回答
举报