posts - 431,  comments - 344,  trackbacks - 0

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> Toggle </TITLE>
  <script type="text/JavaScript">
 function toggle(sDivId) {
  var oDiv = document.getElementById(sDivId);
  oDiv.style.display = (oDiv.style.display == "none") ? "block":"none";
 }

  </script>
 </HEAD>

 <BODY>
 <div style ="background-color:blue; color:white; font-weight:bold; padding:10px; cursor:pointer" onclick="toggle('divContent1');">Click Here</div>
 <div style="border:3px solid blue; height:100px;padding:10px" id="divContent1">
  This is some content to show and hide.
 </div>
 <div style ="background-color:blue; color:white; font-weight:bold; padding:10px; cursor:pointer" onclick="toggle('divContent2');">Click Here</div>
 <div style="border:3px solid blue; height:100px;padding:10px" id="divContent2">
  This is some content to show and hide.
 </div>
 </BODY>
</HTML>

posted on 2008-01-23 16:20 周锐 阅读(438) 评论(0)  编辑  收藏 所属分类: CSSHTMLJavaScript

只有注册用户登录后才能发表评论。


网站导航: