Javascript脚本控制图片轮播的问题:

<script language="javascript">
function alternate()
{
var s=0;
var str=new Array();
str={
"Index/Photos/20110216083802462.jpg",
"Index/Photos/20110216091845177.jpg",
"Index/Photos/20110216095448697.jpg",
"Index/Photos/20110216110652133.jpg",
"Index/Photos/20110216125400102.jpg"
}

if(s>4)
{
s=0;
document.getElementById("bigImage2").src=str[s];
s++;

}
else
{
document.getElementById("bigImage2").src=str[s];
s++;
}

}
setInterval("alternate()",2000);
</script>

请问哪里出错了?为什么老说我缺少对象?

试试这个图片切换

有12345数字一起切换

鼠标点一下数字会变换到另一张图片,不点就会自动换

里面有教程和源码

参考资料:http://www.blueidea.com/common/shoutbox/redir.asp?4=b&id=10895

温馨提示:内容为网友见解,仅供参考
第1个回答  2011-02-17
数组应该这样写:
str=[
"Index/Photos/20110216083802462.jpg",
"Index/Photos/20110216091845177.jpg",
"Index/Photos/20110216095448697.jpg",
"Index/Photos/20110216110652133.jpg",
"Index/Photos/20110216125400102.jpg"
]
第2个回答  2011-02-18
看看在JS转义一下行不行,实在不行就把链接地址,转换成urlcode码,然后在解码,就可以了。
相似回答