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>