function PreviewImg(imgFile,width,height) {
//IE
if (window.navigator.userAgent.indexOf("MSIE")>=1){
imgFile.select();
var imgPath= document.selection.createRange().text;
var newPreview= document.getElementById("preview");
var regext= /\.jpg$|\.gif$|\.jpeg$|\.png$|\.bmp$/gi;
if(!regext.test(imgPath)|| isEmpty(imgPath)){
alert("对不起,系统仅支持标准格式的照片,请您调整格式后重新上传!");
document.getElementById("upLoadButton").disabled=true; //把上传按钮置为灰化
}else{
document.getElementById("upLoadButton").disabled=false;//把上传按钮置为有效
newPreview.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src= imgPath;
newPreview.style.styleFloat ="right";
newPreview.style.width = width+"px";
newPreview.style.height = height+"px";
}
}
}
<html:file property="image" name="photoForm" styleId="pht" size="40" maxlength="40" οnchange="PreviewImg(this,100,120)"/>
<div id="preview" style="border:1px solid black;width:120px;height:150px;text-align: center;">预览</div>
<input type="button" name="up" id="upLoadButton" class="button" value="照片上传" οnclick="UP()">