js顯示隱藏div層代碼

來源:互聯網
上載者:User

js顯示隱藏div層代碼
<script language=javascript>


function toExit(){<!--對隱藏層的操作-->
var args=toExit.arguments;<!--擷取函數的輸入值-->
var visible=args[0];<!--函數的第一個輸入值-->
if(document.all){<!--對於ie瀏覽器-->
  if(visible=='show')visible='visible';<!--設定隱藏層顯示-->
  if(visible=='hide')visible='hidden';<!--設定隱藏層消失-->
  theObj=eval("document.all['"+args[1]+"']");
  if(theObj)theObj.style.visibility=visible;<!--執行上述操作-->
  }

}    

</script>

<div id=div32
style="HEIGHT: 80px; LEFT: 10px; POSITION: absolute; TOP: 10px; VISIBILITY: hidden; WIDTH: 180px; Z-INDEX: 1">
<table bgcolor=#FF9900 border=1 cellpadding=0 cellspacing=0 height=80
  width=180>  <tbody>
                      <tr>
                        <td height=65 width="100%">
                          <table border=0 cellpadding=0 cellspacing=0 height=80 width="99%">
                            <tbody>
                            <tr>
                              <td height=57> <font
            color=#ffffff>歡迎來到javascript世界!這裡有你意想不到奇妙效果!<b></b></font></td>
                            </tr>
                            <tr align="center">
                              <td height=23 width="100%"><a
            href="javascript:toExit('hide','div32')"><font color=white>關閉此層</font></a></td>
                            </tr>
                            </tbody>
                          </table>
                        </td>
                      </tr>
                      </tbody>
                    </table>
                  </div>
<a href="javascript:toExit('show','div32')"><font color="#FF9900">開啟隱藏層</font></a>
<body>

</body>

</html>
<!--本常式實習了開啟活隱藏層的操作-->
<!--瞭解隱藏層的產生機制-->
<!--開啟、關閉隱藏層的造作實現-->
<!--函數的調用-->

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.