<script language="javascript" type="text/javascript">
var flag = false;
function DrawImage(ImgD) {
var image = new Image();
image.src = ImgD.src;
if (image.width > 0 && image.height > 0) {
flag = true;
if (image.width / image.height >= 110 / 150) {
if (image.width > 110) {
ImgD.width = 110;
ImgD.height = (image.height * 110) / image.width;
} else {
ImgD.width = image.width;
ImgD.height = image.height;
}
ImgD.alt = image.width + "×" + image.height;
}
else {
if (image.height > 150) {
ImgD.height = 150;
ImgD.width = (image.width * 150) / image.height;
} else {
ImgD.width = image.width;
ImgD.height = image.height;
}
ImgD.alt = image.width + "×" + image.height;
}
}
/**//**//**//*else{
ImgD.src="";
ImgD.alt=""
}*/
} function FileChange(Value) {
flag = false;
document.all.uploadimage.width = 10;
document.all.uploadimage.height = 10;
document.all.uploadimage.alt = "";
document.all.uploadimage.src = Value;
}
</script><div class="p5 border1"><img id="uploadimage" height="10" width="10" src onload="javascript:DrawImage(this);" alt="头像" /></div>
<div class="mb"><asp:FileUpload ID="FileUpload" runat="server" onchange="javascript:FileChange(this.value);" Width="143px"/></div>
请高手帮忙改一下让他兼容火狐和IE8.通用最好了.目前只支持IE6.360
var flag = false;
function DrawImage(ImgD) {
var image = new Image();
image.src = ImgD.src;
if (image.width > 0 && image.height > 0) {
flag = true;
if (image.width / image.height >= 110 / 150) {
if (image.width > 110) {
ImgD.width = 110;
ImgD.height = (image.height * 110) / image.width;
} else {
ImgD.width = image.width;
ImgD.height = image.height;
}
ImgD.alt = image.width + "×" + image.height;
}
else {
if (image.height > 150) {
ImgD.height = 150;
ImgD.width = (image.width * 150) / image.height;
} else {
ImgD.width = image.width;
ImgD.height = image.height;
}
ImgD.alt = image.width + "×" + image.height;
}
}
/**//**//**//*else{
ImgD.src="";
ImgD.alt=""
}*/
} function FileChange(Value) {
flag = false;
document.all.uploadimage.width = 10;
document.all.uploadimage.height = 10;
document.all.uploadimage.alt = "";
document.all.uploadimage.src = Value;
}
</script><div class="p5 border1"><img id="uploadimage" height="10" width="10" src onload="javascript:DrawImage(this);" alt="头像" /></div>
<div class="mb"><asp:FileUpload ID="FileUpload" runat="server" onchange="javascript:FileChange(this.value);" Width="143px"/></div>
请高手帮忙改一下让他兼容火狐和IE8.通用最好了.目前只支持IE6.360
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货