function InitMsgBox(obj){
var img = document.getElementById("Image1");
//设置缩略图的初始宽度和高度
var xw=80;
var xl=80;
//图片高宽
var width = img.width;
var height = img.height;
var bili1 = width/height;
var bili2 = height/width;
if(width >= height)
{
img.width = xw * bili2;
}
else
{
img.height = xl * bili1;
}
img.src = obj.value;
}
<asp:FileUpload ID="FileUpload1" runat="server" οnchange="javascript:InitMsgBox(this)"
Width="230px" />