久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      javascript怎么實(shí)現(xiàn)點(diǎn)擊按鈕隱藏div

      方法:1、用“按鈕對象.onclick=function(){}”語句給按鈕綁定點(diǎn)擊事件處理函數(shù);2、處理函數(shù)中,添加“div對象.style.display="none"”語句;3、點(diǎn)擊按鈕會觸發(fā)處理函數(shù),執(zhí)行其中的語句即可隱藏div。

      javascript怎么實(shí)現(xiàn)點(diǎn)擊按鈕隱藏div

      本教程操作環(huán)境:windows7系統(tǒng)、javascript1.8.5版、Dell G3電腦。

      javascript實(shí)現(xiàn)點(diǎn)擊按鈕隱藏div

      根據(jù)id 按鈕獲取點(diǎn)擊事件,添加事件處理函數(shù)

      <input type="button" value="隱藏" id="btn"/> <!--<input type="button" value="顯示" id="btn1"/>--> <div id="dv"></div> <script> 	function my(id){ 		return document.getElementById(id); 	} 	my("btn").onclick=function(){ 			my("dv").style.display="none"; 	} </script>

      效果圖:

      javascript怎么實(shí)現(xiàn)點(diǎn)擊按鈕隱藏div

      復(fù)雜一點(diǎn),如果div是顯示的,點(diǎn)擊按鈕可隱藏;如果div是隱藏的,點(diǎn)擊按鈕可顯示。

      <input type="button" value="隱藏" id="btn"/> <!--<input type="button" value="顯示" id="btn1"/>--> <div id="dv"></div> <script> 	function my(id){ 		return document.getElementById(id); 	} 	my("btn").onclick=function(){ 		if (this.value =="隱藏") { 			my("dv").style.display="none"; 			this.value="顯示"; 		} else if(this.value =="顯示"){ 			my("dv").style.display="block"; 			this.value="隱藏"; 		} 	} </script>

      效果圖:

      javascript怎么實(shí)現(xiàn)點(diǎn)擊按鈕隱藏div

      【推薦學(xué)習(xí):javascript高級教程】

      贊(1)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號