<html>
<head>
<title>window.onload</title>
<script type="text/javascript">
window.onload = function(){
setInterval(step,1000);
}
var num=1;
function step(){
if(num < 5){
num++;
}else{
num = 1;
}
var dom = document.getElementById("imgId");
//
dom.src = num + '.jpg';
}
</script>
</head>
<body>
<img src="1.jpg" width="500" height="500" id="imgId"/>
</body>
</html>
window onload 实例 【2018.11.27】
猜你喜欢
转载自blog.csdn.net/weixin_30589127/article/details/84574693
今日推荐
周排行