<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="Generator" content="EditPlus"> | |
<meta name="Author" content=""> | |
<meta name="Keywords" content=""> | |
<meta name="Description" content=""> | |
<title>auto刷新图片</title> | |
<script type="text/javascript"> | |
function refreshImg(){ | |
var i = Math.random()*6;//获得随机数 | |
document.getElementById("image").src="images/"+Math.ceil(i)+".jpg";//获取图片路径 | |
setTimeout("refreshImg()",2000);//每两秒自动刷新 | |
} | |
</script> | |
<body onload="refreshImg()"> | |
每2秒自动刷新图片: | |
<img src="images/1.jpg" width="300" id="image"/> | |
</body> | |
</html> | |
自动刷新图片
最新推荐文章于 2023-08-20 16:33:10 发布