图片轮播
请大家帮看一下下<!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>
<!--声明当前页面编码集charset=gbk中文编码gb2321;charset=utf-8国际编码-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>向上图论</title>
<style type="text/css">
body{background:#e4e4e4}//*css定义区开始*//
*{margin:0px;}
#flish{width:
670px;
height:240px;
background:#93C;
margin:200px auto 0px;
position:relative;
overflow:hidden;
}
#flish .scroll{
width:670px;
height:240000%;
background:#CCC;
position:absolute;
left:0px;
top:-240px;
}
#flish .scroll img{display:block;}
#flish ul.button li{
list-style-type:none;
width:20px;
height:20px;
background:#999;
float:left;margin:0px 2px;
color:#FFF;text-align:center;
font-size:12px;
line-height:20px;
border-radius:10px;
box-shadow:0px 0px 5px #000;
}
#flish ul.button{
position:absolute;
bottom:20px;
right:10px;
}
#flish ul.button li.hover{
background:#ff0066;
}//*定义区结束*//
</style>
</head>
<body>
<div id="flish">
<div class="scroll"><!--插入图片-->
<img src="tp/4.jpg" width="670" height="240"/>
<img src="tp/1.jpg" width="670" height="240"/>
<img src="tp/2.jpg"width="670" height="240"/>
<img src="tp/3.jpg" width="670" height="240"/>
<img src="tp/bn-txf.jpg" width="670" />
<img src="tp/bn-wsgw.jpg" width="670" />
</div>
<!--按钮开始-->
<ul class="button">
<li class="hover">1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul><!--按钮结束-->
</div>
<!--滚动开始-->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
var _index=0;
var setTime=null;
$("ul.button li").hover(fuction(){
clearInterval(setTime);//清除定时播放器
index=$(this).index();
//alert(index);
//添加class="hover"
$(this).addClass("hover").siblings("li").removerClassover("hover");
$(".scroll").animate({top:(_index*240)},1000);
}.function(){autoPlay();//鼠标移开调用自动播放
});
//自动轮播
function autoPlay(){
setTime=setInterval(function(){
_index++; //序列号加
if(_index>5){_index=0;}//当播放到第五张时,转到第一张
$("ul.button li").eq(_index).addClass("hover").siblings("li").removerClassover("hover");
$(".scroll").animate({top:=(_index*240)},1000);
},2000);
}
autoPlay();
</script>
<!--滚动结束-->
</body>
</html>
面这段代码错在哪里老是无法实现动态效果。