【发布时间】:2011-12-14 21:18:12
【问题描述】:
我做了一个简单的鼠标悬停效果,它适用于所有浏览器,但火狐除外。我已将代码精简到最低限度,但无法弄清楚出了什么问题!为什么下面的鼠标悬停在 Firefox 中不起作用?
<!DOCTYPE html>
<html>
<head>
<style>
#box {
background:#222;
width:400px;
height:300px;
border-radius:5px;
}
#box_hover {
background:#555;
width:400px;
height:300px;
border-radius:5px;
}
</style>
<script type="text/jscript">
function mouseover() {
document.getElementById('box').id = 'box_hover';
}
function mouseout() {
document.getElementById("box_hover").id = 'box';
}
</script>
</head>
<body>
<div id="box" onmouseover="mouseover();" onmouseout="mouseout();"></div>
</body>
</html>
【问题讨论】: