IE浏览器通过JS提交表单时报错拒绝访问

form表单填写完毕后,点击提交没反应,无法保存,通过F12查看原来是script拒绝访问

我用的是document.stuForm.submit();方法

原来是文中包含图片上上传,而我文件上传用到了点击图片触发file上传方法,

function addFile(){
        document.getElementById("file").click();
    }

<c:if test="${zp.id eq null}">
                                            <img src="${pageContext.request.contextPath}/images/tx.jpg" id="imghead" width="130" height="167" οnclick="addFile()"/><br/>
                                        </c:if>
                                        <c:if test="${zp.id ne null}">
                                            <img src="${pageContext.request.contextPath}${zp.filepath}" id="imghead"  width="130" height="167" alt="${zp.newfilename}"/><br/>
                                        </c:if>
                                        <input type="hidden" id="files" name="zpid" value="${zp.id}"/>
                                        <input type="file" id="file" name="impData" value="123" οnchange="addIMG(this)"  UNSELECTABLE="on" dataType="file"/>

这种方法是不支持的

所以只能通过点击file按钮上传图片,才可以成功

<c:if test="${zp.id eq null}">
                                            <img src="${pageContext.request.contextPath}/images/tx.jpg" id="imghead" width="130" height="167" /><br/>
                                        </c:if>
                                        <c:if test="${zp.id ne null}">
                                            <img src="${pageContext.request.contextPath}${zp.filepath}" id="imghead"  width="130" height="167" alt="${zp.newfilename}"/><br/>
                                        </c:if>
                                        <input type="hidden" id="files" name="zpid" value="${zp.id}"/>
                                        <input type="file" id="file" name="impData" value="123" οnchange="addIMG(this)"  UNSELECTABLE="on" dataType="file"/>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值