<script type="text/javascript">
var imgnumber = 1;
function showimage() {
imgnumber++;
document.getElementById('bao1').setAttribute('src', 'images/1.jpg');
if (imgnumber == 4) {
imgnumber = 0;
}
}
var clearid;
function clearfun() {
clearInterval(clearid);
}
clearid = setInterval(showimage, 1000);
</script>
</head>
<body>
<img alt="" id="bao1" src="images/4.jpg" width="200px" height="300px"/>
<input id="Button1" type="button" value="点击轮换" οnclick="showimage()" />
<input id="Button2" type="button" value="轮换停止" οnclick="clearfun()"/>
</body>
var imgnumber = 1;
function showimage() {
imgnumber++;
document.getElementById('bao1').setAttribute('src', 'images/1.jpg');
if (imgnumber == 4) {
imgnumber = 0;
}
}
var clearid;
function clearfun() {
clearInterval(clearid);
}
clearid = setInterval(showimage, 1000);
</script>
</head>
<body>
<img alt="" id="bao1" src="images/4.jpg" width="200px" height="300px"/>
<input id="Button1" type="button" value="点击轮换" οnclick="showimage()" />
<input id="Button2" type="button" value="轮换停止" οnclick="clearfun()"/>
</body>