js 通过src 获取图片大小

来源:互联网 发布:mac双系统安装win8 编辑:程序博客网 时间:2024/05/22 16:49
checkImgWidHei("<%=basePath%>"+response);
传一个src
 
function checkImgWidHei(imgSrc){    var img = new Image();    img.onload = function(){    img.onload = null;   if(img.width!=869){alert("图片宽度不等于标准尺寸869px");document.getElementById("credetPhotoImage").src ="<%=basePath%>source/image/big.png";}else if(img.height!=489){alert("图片高度不等于标准尺寸489px");document.getElementById("credetPhotoImage").src ="<%=basePath%>source/image/big.png";}    };    img.src = imgSrc;}

	
				
		
原创粉丝点击