title slipe
<script type="text/javascript">
var picture = ["1.jpg","2.jpg","3.jpg"];
var web = ["www.baidu.com","http://muchong.com/","https://translate.google.cn/"];
var count = 0;
var message = "";
function run(){
setInterval(cycle,2000);
}
function cycle(){
count ++;
if(count == picture.length) count = 0;
document.getElementById("img").src = picture[count];
document.getElementById("a").href = web[count];
}
</script>
script代码:
<script type="text/javascript">
var banner = ["1.jpg","2.jpg","3.jpg"];
var count = 0;
function run(){
setInterval(cycle,2000);
}
function cycle(){
count ++;
if(count == banner.length) count = 0 ;
document.getElementById("banner").src = banner[count];
}
</script>
html页面部分:
<body οnlοad="run();">
<img id="banner" alt="picture" src="1.jpg" />
给滚动的图片加上超链接: