任何人都可以告诉我为什么即使通过使用 fireBug 调试脚本正确地找到了正确的元素,style.display 并没有更新 ul 的属性,它仍然设置为 none?
<html>
<div id="nav">
<ul>
<li><a href="" onmouseover="show()">Studio</a>
</li>
</ul>
</div>
<div id="subnav1">
<ul style="display: none">
<li><a href="">normally hidden</a>
</li>
</ul>
</div>
<script type="text/javascript" src="jquery-1.4.3.min.js"></script>
<script type="text/javascript">
function show()
{
var subNav1 = document.getElementById("subnav1");
var ull = subNav1.getElementsByTagName("ul");
for (var i = 0, ii = ull.length; i < ii; i++)
{
if(ull[i].style.display == "visible")
{
ull[i].style.display = "none";
}
else
{
ull[i].style.display = "visible";
}
}
};
</script>
</html>