IE8下上传文件方式

1.准备页面,

加入

<form name="uploadform" id="uploadform" method="post" action="queryCriteriaBD!uploadImageProxy.action" target="file_upload_return" enctype="multipart/form-data">
<div class="top-nav-condition-left-xuanze-imgbox">
<a class="btn_addPic" href="javascript:void(0);" title="支持jpg、jpeg格式,文件小于5M">
<img class="top-nav-condition-left-xuanze-img" id="top_nav_condition_left_xuanze_img" title="支持jpg、jpeg格式,文件小于5M" src="../../srtProject/sysc/imgs/SelectImg.png"/>
<div class="top-nav-condition-left-xuanze-img" id="top_nav_condition_left_xuanze_imgDiv" style="display:none;"></div>
<input type="file" tabIndex="3" size="3"  class="filePrew" οnchange="chacgeImg(this.value);" id="file" name="file" title="支持jpg、jpeg格式,文件小于5M">
</a>
</div>
<div class="top-nav-condition-left-xuanze-btnbox" style="display:block;">
<input type="submit" class="frame-btn top-nav-condition-left-xuanze-btn1" value="上传图片" id="file_up">
</div> 
</form>


<iframe name="file_upload_return" id="file_upload_return"  style="width:0px;height:0px;border:none;overflow:hidden;"></iframe>


2.在js中加入

//图片预览chacgeImg
function chacgeImg(value){
jQuery("#loadgif").css("display","block");
var imgType=value.substring(value.lastIndexOf("."));
if(imgType!=".jpg" && imgType!=".JPG"){
jQuery("#loadgif").css("display","none");
window.alert("图片只支持(.jpg、.JPG)格式");
}else{
jQuery("#loadgif").css("display","none");
jQuery("#top_nav_condition_left_xuanze_img").css("display","none");
var imgDiv = document.getElementById("top_nav_condition_left_xuanze_imgDiv"); 
        imgDiv.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod = scale)";
         imgDiv.filters("DXImageTransform.Microsoft.AlphaImageLoader").src = value;
jQuery("#top_nav_condition_left_xuanze_imgDiv").css("display","block");

}
}

3.返回iframe的加载成功方法:

jQuery("#file_upload_return").load(function(){
var bodyContent = window.frames["file_upload_return"].document.body.innerHTML;
alert(bodyContent );
});

4.完成了上传文件,并获取返回值信息。



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

喵喵先森

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值