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"/>