onAbort onError onKeyDown onKeyPress onKeyUop onLoad
例1:(预载)
<Script>
img0 = new Image();
img0.src = "images/snow0.gif";
img1 = new Image();
img1.src = "images/snow1.gif";
document.write ("已经读取两个图文件,但此时不显示。");
</Script>
例2:
<Script>
function img-preload(idx){
eval("img"+idx+" = new Image()");
eval("img"+idx+".src = 'images/snow"+idx+".gif'");
}
img-preload(0);
img-preload(1);
document.write ("已经读取两个图文件,但此时不显示。");
</Script>
例3:
<Script>
function img-preload(imgname,idx){
eval("img"+idx+" = new Image()");
eval("img"+idx+".src = 'images/"+imgname+".gif'");
}
img-preload("snow0",0);
img-preload("snow1",1);
document.write ("已经读取两个图文件,但此时不显示。");
</Script>