81,092
社区成员
发帖
与我相关
我的任务
分享
if(flag){
var img= new Image();
if(names[0].value!=""){
img.src=names[0].value;
alert(img.width);//弹出图片宽度
if(img.width>990||img.width<850){
alert("上传图片宽必须为850px到990px之间!");
return false;
}else if(img.height<300||img.height>350) {
alert("上传图片高必须为300px到350px之间!");
return false;
}else {
return true;
}
}
return false;
}else{
alert('请选择你要上传的相片!');
}