var images = new Array()
function preload() {
for (i = 0; i < preload.arguments.length; i++) {
images[i] = new Image()
images[i].src = preload.arguments[i]
}
}
function preloader() {
if (document.images) {
preload("img/a1.png", "img/a2.png",
"img/a3.png", "img/a4.png", "img/b1.png",
"img/b2.png", "img/b3.png","img/b4.png"
)
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(preloader);
原文:http://web.jobbole.com/86785/
网友评论