<html>
......
<body>
......
<img src="imges/人们武装.jpg" id="img" />
.....<!--script调用的为新闻列表-->
<script src="http://210.43.0.10/inc/inc_article_l.asp?css=article&num=7&long=20&m=1&siteid=baowei_chu&columnID=人民武装"></script>
....................
</body>
</html>
要求:
定时改变img的src属性,即img的src值在“imges/人民武装.jpg”和“imges/安全保卫.jpg”之间定时切换,并且对应切换script的columnID的值,也即scrip的columnID的值在“人民武装”和“安全保卫”之间定时切换。
asp文档,求解
......
<body>
......
<img src="imges/人们武装.jpg" id="img" />
.....<!--script调用的为新闻列表-->
<script src="http://210.43.0.10/inc/inc_article_l.asp?css=article&num=7&long=20&m=1&siteid=baowei_chu&columnID=人民武装"></script>
....................
</body>
</html>
要求:
定时改变img的src属性,即img的src值在“imges/人民武装.jpg”和“imges/安全保卫.jpg”之间定时切换,并且对应切换script的columnID的值,也即scrip的columnID的值在“人民武装”和“安全保卫”之间定时切换。
asp文档,求解
function change(){
document.getElementById("img").src="images/2.jpg";
}
function change2(){
document.getElementById("img").src="images/1.jpg";
}
function time1(){
setInterval(change(),3000);
}
function time2(){
setInterval(change2(),6000);
}
</script></head><body onLoad="time1();time2();">
这样为啥不行啊
function change(){
document.getElementById("img").src="images/2.jpg";
}
function change2(){
document.getElementById("img").src="images/1.jpg";
}
function time1(){
setInterval(change(),3000);
}
function time2(){
setInterval(change2(),6000);
}
</script></head><body onLoad="time1();time2();">
这样为啥不行啊
<script language="javascript">
function change(){
document.getElementById("img").src="images/2.jpg";
}
function change2(){
document.getElementById("img").src="images/1.jpg";
}
function time1(){
setInterval(change(),3000);
}
function time2(){
setInterval(change2(),6000);
}
</script></head><body onLoad="time1();time2();">
这样为啥不行啊
在里面判断一下当前的src再赋值setInterval("change()",3000);
function change(){
if(document.getElementById("img").src == "images/1.jpg" ){
document.getElementById("img").src="images/2.jpg";
}
if(document.getElementById("img").src == "images/2.jpg" ){
document.getElementById("img").src="images/1.jpg";
}
}
function time(){
setInterval(change(),1000);
}
</script><body onLoad="time();">
<img src="" alt="" width="317" height="140" border="0" id="img"/> </tr>