//原生js写的时候,img.src一定要写在onload后面,不然IE会不兼容
也可以通过$browser.msie的img.readystate和 $browser.mozilla的img.complete来加以区分
function loadImg(imgUrl, srcImg) {
var imgLoading = document.getElementById(srcImg);var o = new Image();
$("div.picMask").show();
o.onload = function() {
$("div.picMask").hide();
o.id = (imgLoading.id);
o.width = (imgLoading.width);
o.height = (imgLoading.height);
imgLoading.parentNode.appendChild(o)
imgLoading.parentNode.removeChild(imgLoading);
}
o.src = imgUrl;
}
//通过jquery实现非常方便
function loadZoomPic() {
var smallImgs = $('#thumbs li a img');
var urlList = $('#thumbs li a input'); //隐藏于url
$.each(urlList,function(i,path){
var img = new Image();
var imgLoading = smallImgs[i];
img.src=path.value;
$("div.smallmask").show();
$("div.smallmaskTop").show();
$(img).load(function(){
$("div.smallmask").hide();
$("div.smallmaskTop").hide();
img.width = (imgLoading.width);
img.height = (imgLoading.height);
imgLoading.parentNode.appendChild(img)
imgLoading.parentNode.removeChild(imgLoading);
})
})
return false;
}