function preloader () {
if (document .getElementById ) {
document .getElementById ("bg1" ).style.background = "url() center no-repeat" ;
document .getElementById ("bg2" ).style.background = "url() center no-repeat" ;
document .getElementById ("bg3" ).style.background = "url() center no-repeat" ;
document .getElementById ("bg4" ).style.background = "url() center no-repeat" ;
document .getElementById ("bg5" ).style.background = "url() center no-repeat" ;
document .getElementById ("bg6" ).style.background = "url() center no-repeat" ;
}
}
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 );
});//bg1----bg5是页面的div的id
//
url() center no-repeat
//图片的路径和自适应图片的大小