var Imgvalue;
var Count =13;
var Imgs = new Array(Count);
var ImgLoaded =0;
//預先載入圖片
function preLoadImgs()
{
alert('圖片載入中請稍加等......');
for(var i=0;i
Imgs[i]=new Image();
downloadImage(i);
}
}
//載入單一圖片
function downloadImage(i)
{
var imageIndex = i 1; //圖片以1開始
.src = "images/" imageIndex ".jpg";
Imgs[i].onLoad=validateImages(i);
}
//驗證是否成功載入完成,如不成功則重新載入
function validateImages(i){
if (!Imgs[i].complete)
{
window.setTimeout('downloadImage(' i ')'200Time window.setTime >else if (typeof Imgs[i].naturalWidth != "undefined" && Imgs[i].naturalWidth == 0)
{
window.setTimeout('downloadImage(' i ')',,200 '
}
else
{
ImgLoaded
document.getElementById('BtnStart').disabled=false;
.getElementById('BtnStop').disabled=false;
alert('圖片載入完成! ');
}
}
}
//開始
function RandStart()
{
>}
//隨機顯示
function SetRand()
{
imageIndex = Math.floor(Math.random()*Count);
ent document ). src = Imgs[imageIndex].src;
}
//結束
function RandStop()
{
window.arInterval(Init);
}