这段代码有什么问题?
实际上,我正在尝试在我的 html 页面上实现简单的图像滑块,我在 setInterval 函数上遇到错误,我找不到它。我试图从控制台找出错误,但我不能。
<script>
function slider(){
$(".slider #1").show("fade" , 500);
$(".slider #1").delay(5500).hide("slide",{direction:"left"},500);
var sc = $(".slider img").size();
var count = 2;
setInterval(function(){
$(".slider #"=count).show("slide",{direction:"right"},500);
$(".slider #"=count).delay(5500).hide("slide",{direction:"left"},500);
if(count == sc){
count = 1;
}else{
count = count+1;
}
},5500);
}
</script>
</head>
<body onload="slider()">
<div class="slider" >
<img id="1" src="images/slider1.jpg" border="0" alt="slider1">
<img id ="2" src="images/slider2.jpg" border="0" alt="slider2">
<img id ="3" src="images/slider3.jpg" border="0" alt="slider3">
<img id ="4" src="images/slider4.jpg" border="0" alt="slider4">
</div>
<div class="clear"></div>
</body>
控制台错误是:ReferenceError:无效分配左侧
谢谢。