表单代码:
<form name="uploadExcelForm" action="nodeIssueleft!batchPublish.do" method="post" target="mainFrame"
enctype="multipart/form-data">
<div style="text-align: center;">
<input type="file" name="uploadExcel" value="" id="upload_excel_file" />
<input id = "batch_publish_form_button_id" type="button" value="批量发布" />
<span style="display:none"><input id = 'batch_publish_form_reset' type = "reset" value = "重置"/></span>
</div>
</form>
jQuery:
1 $('#upload_excel_file').val('')火狐和360上都可以,但是IE8、IE9都不可以。
下面我们介绍第二种方法,这种方法支持火狐、360、IE8、IE9,别的浏览器没测。
2 $('#batch_publish_form_reset').click(); 触发reset按钮的单击事件

本文介绍了一种适用于多种浏览器(包括IE8/9、火狐和360)的表单文件上传方法,并提供了两种重置表单的有效方式:直接清空文件输入框值与触发重置按钮。
324

被折叠的 条评论
为什么被折叠?



