我做了一個簡單的onmousehover效果,它適用於所有瀏覽器,但firefox。我已經將代碼剝離到最低限度,但無法弄清楚什麼是錯的!爲什麼下面的鼠標懸停工作在Firefox?OnMouseHover不工作在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>