(currentStyle)javascript為何有時用style得不到已設定的CSS的屬性

來源:互聯網
上載者:User

這是按第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>
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.