javascript show or hide div

2011年5月3日 星期二 by Hu, Ching-Hsiang

<script language="javascript">
function toggle() {
 var ele = document.getElementById("toggleText");
 if(ele.style.display == "block") {
      ele.style.display = "none";
   }
 else {
  ele.style.display = "block";
 }
}
</script>

<div id="toggleText" style="display: none">
<h1>test</h1>
</div>

Filed under having  

0 意見: