停不了???cleartimeout()
<!doctype html><html>
<head>
<meta charset="utf-8">
</head>
<script>
function preLoadImage()
{
image=new Array();
image[0]=new Image();
image[0]="1.jpg";
image[1]=new Image();
image[1]="2.jpg";
image[2]=new Image();
image[2]="3.jpg";
}
var i=0;
function startShow()
{
if(i<image.length)
{
document.images["image1"].src=image[i];
i++;
}
else
{
i=0;
document.images["image1"].src=image[i];
}
var timeout;
timeout=setTimeout('startShow()',150);
}
function stopShow()
{
clearTimeout(timeout);
}
</script>
<body onLoad="preLoadImage()">
<img src="1.jpg" height="500" width="500"name="image1">
<input type="button" value="StartShow" onClick="startShow();"/>
<input type="button" value="StopShow" onClick="stopShow();"/>
</body>
</html>