利用javascript 隱藏div
如題,
碼:
<html> <body> <form name=Form1> <script language="javascript"> function ShowDiv(oRad) { var Layer_choice; //抓div if (document.getElementById) { //Netscape 6.x Layer_choice = eval("document.getElementById('div_choice')"); } else { // IE 5.x Layer_choice = eval("document.all.choice.div_choice"); } //顯示或隱藏DIV if(Layer_choice)//先判斷是否存在 { if(oRad.value=="1") { Layer_choice.style.display=''; }else { Layer_choice.style.display='none'; } } } </script> <input type="radio" value="1" name="radShow" onclick="ShowDiv(this)">顯示 <input type="radio" value="0" name="radShow" onclick="ShowDiv(this)">不顯示 <div id="div_choice" style="display:none" > test1111fff </div> </form> </body> </html> 還有一種方法是直接隱藏按鈕 input.button { width:114px; height:37px; border: none; background: transparent url(images/submit_btn.gif) no-repeat center; overflow: hidden; text-indent: -999px; font-size: 0; display:block; line-height:0 }
Leave a comment
抱歉,你必須要登入才能發表迴響喔!