<script language="javascript" type="text/javascript">
/*上传图片预览函数*/
function PreviewImg(imgFile, id){
//支持 IE6、IE7。
var newPreview = document.getElementById(id);
try{
newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").enabled = true;
newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
//newPreview.style.display = "block";
}catch(e){
}
}
/*删除预览图片*/
function HidePreImg(imgFile, id){
var preDIV = document.getElementById(id);
preDIV.outerHTML = preDIV.outerHTML; //把表单元素file置空.
try{
imgFile.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").enabled = false;
}catch(e){
}
//imgFile.style.display = "none";
}
</script>
<style type="text/css">
.newPreview{
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
border:1px dashed rgb(204, 204, 204);
width:80px;
height:60px;
/*display:none;*/
}
</style>
<span id="newPreview1" class="newPreview" alt="双击图片删除选择" οndblclick="HidePreImg(this, 'pic1')"></span>
<input type="file" name="pic1" id="pic1" onChange="PreviewImg(this, 'newPreview1')"><br>
<span id="newPreview2" class="newPreview" alt="双击图片删除选择" οndblclick="HidePreImg(this, 'pic2')"></span>
<input type="file" name="pic2" id="pic2" onChange="PreviewImg(this, 'newPreview2')"><br>
<span id="newPreview3" class="newPreview" alt="双击图片删除选择" οndblclick="HidePreImg(this, 'pic3')"></span>
<input type="file" name="pic3" id="pic3" onChange="PreviewImg(this, 'newPreview3')"><br>
<span id="newPreview4" class="newPreview" alt="双击图片删除选择" οndblclick="HidePreImg(this, 'pic4')"></span>
<input type="file" name="pic4" id="pic4" onChange="PreviewImg(this, 'newPreview4')"><br>