`

jQuery淡入淡出

阅读更多
虽然很简单,但我在这里记录一下,以后忘记的话,可以来这里查看:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    $("button").click(function () {
	  if($(this).html() == "Hide"){
	    $(this).html("Show");
		$("p").show(600);
	  } else {
		$(this).html("Hide");
		$("p").hide(600);
	  }
    });    
  });
  </script>
  <style>
  p { background:#dad; font-weight:bold; }
  </style>
</head>
<body>
  <button align="right">Hide</button>
  <p style="display: none;">Hiya</p>
  <p style="display: none;">Such interesting text, eh?</p>
</body>
</html>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics