先试试
脚本之家欢迎您
切换隐藏
1 <style type="text/css"> 2 #thediv 3 { 4 width:200px; 5 height:100px; 6 line-height:100px; 7 text-align:center; 8 background-color:green; 9 } 10 </style> 11 <script type="text/javascript"> 12 function Show_Hidden(obj) 13 { 14 if(obj.style.display=="block") 15 { 16 obj.style.display='none'; 17 } 18 else 19 { 20 obj.style.display='block'; 21 } 22 } 23 window.onload=function() 24 { 25 var olink=document.getElementById("link"); 26 var odiv=document.getElementById("thediv"); 27 olink.onclick=function() 28 { 29 Show_Hidden(odiv); 30 return false; 31 } 32 } 33 </script> 34 </head> 35 <body> 36 <a href="#" id="link">显示隐藏切换</a> 37 <div id="thediv" style="display:block">脚本之家欢迎您</div>