js预载图片

function preloadedImages()
{
heavyImage1 = new Image();
heavyImage1.src = “images/button/images/nav_buttons_rollover_01.gif”;
heavyImage2 = new Image();
heavyImage2.src = “images/button/images/nav_buttons_rollover_02.gif”;
heavyImage3 = new Image();
heavyImage3.src = “images/button/images/nav_buttons_rollover_03.gif”;
heavyImage4 = new Image();
heavyImage4.src = “images/button/images/nav_buttons_rollover_04.gif”;
heavyImage5 = new Image();
heavyImage5.src = “images/button/images/nav_buttons_rollover_05.gif”;
heavyImage6 = new Image();
heavyImage6.src = “images/button/images/nav_buttons_rollover_06.gif”;
heavyImage7 = new Image();
heavyImage7.src = “images/button/images/nav_buttons_rollover_07.gif”;
heavyImage8 = new Image();
heavyImage8.src = “images/button/images/nav_buttons_rollover_08.gif”;
}
再body里onload=”preloadedImages()”
当然,我习惯使用jquery了:)
$(document).ready(function(){
preloadedImages();
})

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

72 − = 68