(currentStyle)javascript为何有时用style得不到已设定的CSS的属性


这是按第2下兰色的横条才开始出效果,就是说第1下没有获得foot.style.display=="none",可是CSS里我定义了
<style type="text/css">
#top {width:100px; background-color:#00CCFF; height:20px}
#foot {width:100px; background-color: #CCCC00; height:50px; display:none}
</style>
<script language="javascript">
<!--
function qa(){
if (foot.style.display=="none") {
foot.style.display="block";};
else {
foot.style.display="none";}
}
-->
</script>
</head>
<body>
<div id="top" onclick="qa()"></div>
<div id="foot">
</body>

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3