标签:
<html>
<head>
<script type="text/javascript">
myImages=new Array()
myImages[0]="/i/eg_mouse.jpg"
myImages[1]="/i/eg_smile.gif"
myImages[2]="/i/eg_landscape.jpg"
myImages[3]="/i/eg_landscape2.jpg"
myImages[4]="/i/eg_landscape3.jpg"
myImages[5]="/i/eg_greanfoliage.jpg"
imagecounter=myImages.length-1
i=0
function first()
{
document.getElementById(‘imageviewer‘).src=myImages[0]
i=0
}
function previous()
{
if (i>0)
{
i--
document.getElementById(‘imageviewer‘).src=myImages[i]
}
}
function next()
{
if (i<imagecounter)
{
i++
document.getElementById(‘imageviewer‘).src=myImages[i]
}
}
function last()
{
document.getElementById(‘imageviewer‘).src=myImages[imagecounter]
i=imagecounter
}
function scroll(){
if(i<imagecounter){
i++
document.getElementById(‘imageviewer‘).src=myImages[i]
timer=setTimeout("scroll()",1000)
}
if(i==imagecounter){
i=0
}
}
function stop(){
clearTimeout(timer)
}
</script>
</head>
<body onload="scroll()" onunload="stop()">
<center>
<form>
<input type="button" value="First" onclick="first()">
<input type="button" value="Previous" onclick="previous()">
<input type="button" value="Next" onclick="next()">
<input type="button" value="Last" onclick="last()">
</form>
<img id="imageviewer" src="/i/eg_mouse.jpg" />
</center>
</body>
</html>
标签:
原文地址:http://my.oschina.net/tianyuqin/blog/376541