用JQ写Tab切换,不知道JS部分还能不能再精简?

<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<style type="text/css">
ul {padding:0; margin:0; list-style:none; overflow:hidden;}
li {width:200px; height:50px; border:1px black solid; float:left;}
.outer {width:604px; height:300px; border:1px red solid; margin-top:20px;}
.inner {width:604px; height:300px; overflow:hidden; text-align:center; line-height:300px; font-size:100px; font-weight:bold; display:none;}
.block {display:block;}
.red {background:red;}
</style>
<script type="text/javascript" src="jQuery.js"></script>
</head>
<body>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<div class="outer">
<div class="inner block">1</div>
<div class="inner">2</div>
<div class="inner">3</div>
</div>
</body>
<script type="text/javascript">
<!--
var inners = $('.outer div');
var buts = $('li');
buts.mouseover(function(){              
  inners.removeClass('block');          //这俩行才是管用的
  $(inners[buts.index(this)]).addClass('block');
});
//-->
</script>
</html>

posted @ 2012-06-25 18:17  丛子  阅读(1124)  评论(0编辑  收藏  举报