`
Forestsai
  • 浏览: 19598 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

Jquery -章节1

 
阅读更多

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>example</title>
<style type="text/css">
 body { width:760px; }                                                               
 div { float:left; width:200px; margin:10px 20px; font-family:\5FAE\8F6F\96C5\9ED1; }
 h3 { cursor:pointer; margin:0; border:1px solid black; color:white; background-color:green; }
 ul { list-style:none; margin:5px 0; padding:5px 0; border:1px solid black; background-color:gold; display:none; }
 .highlight{ color:black; background-color:gold; }
</style>
<script src="jquery-1.6.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
 $(document).ready(function(){
  $("h3").click(function(){
  $(this).toggleClass("highlight")
       .next("ul").toggle();
  });
 });
</script>
</head>
<body>
 <div>
  <h3>sub 1(click me)</h3>
  <ul>
   <li>param 1</li>
   <li>param 2</li>
   <li>param 3</li>
  </ul>
 </div>
 <div>
  <h3>sub 2(click me)</h3>
  <ul>
   <li>prama 1</li>
   <li>prama 2</li>
   <li>prama 3</li>
  </ul>
 </div>
 <div>
  <h3>sub3 (click me)</h3>
  <ul>
   <li>param 1</li>
   <li>param 2</li>
   <li>param 3</li>
  </ul>
 </div>
</body>
</html>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics