[javascript]代码库
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>二级tab切换</title>
<style type="text/css">
*{margin:0;padding:0;}
body{padding:10px ;}
#div1{background:#333;height:30px;width:400px;margin:0 0 10px 0;}
#div1 li { width: 100px; float:left;line-height:30px; background: 333; margin:0 5px;list-style:none; text-align: center;}
#div1 li a { color:#fff; text-decoration:none;font-size:12px; display:block;}
#div1 li a:hover { text-decoration:underline;}
#div1 li span { display: none;}
</style>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
</head>
<body>
<div id="div1">
<ul id="nav">
<li>
<a href="#">menu</a>
<span><a href="http://www.sunflowamedia.com/blog/">1</a></span>
</li>
<li>
<a href="#">menu</a>
<span><a href="http://www.sunflowamedia.com/blog/">2</a></span>
</li>
<li>
<a href="#">menu</a>
<span><a href="http://www.sunflowamedia.com/blog/">3</a></span>
</li>
</ul>
</div>
</body>
<script type="text/javascript">
$(document).ready(function() {
$("ul#nav li").hover(function() { //Hover over event on list item
$(this).find("span").show(200).css({ 'background' : '#1376c9','display' : 'block'}); //Show the subnav
} , function() { //on hover out...
$(this).find("span").hide(200); //Hide the subnav
});
});
</script>
</html>