<FORM NAME="oForm" ACTION="www.baidu.com" ENCTYPE="multipart/form-data" METHOD="post"> <input type='text' name='excel_report_text' id='excel_report_text' />
<input type='button' name='excel_report_btn' value='dianji..' class="button" style='height:20px' onclick="document.getElementById('excel_report').click();"/>
<input type='file' name='excel_report' size='30' id='excel_report' onpropertychange="document.getElementById('excel_report_text').value = document.getElementById('excel_report').value;" style="display:'none'"/>
<br>
<input type='submit' value='click to submit'/></FORM>当我选择了文件,然后提交表单的时候,第一次提交会无效。第二次才会提交。
当我不选择文件的时候,表单会直接提交,请问这里是怎么错了。
无法提交
第二下点击击'click to submit'
表单提交。
style="display:''
可以看到,当点击dianji.. 选择文件之后,
再点击 'click to submit'两个控件都被清空了。
<input type='button' name='excel_report_btn' value='dianji..' class="button" style='height:20px' onclick="function(){document.getElementById('excel_report').click();}"/>这样应该可以
安全机制的问题,不允许用这种凡是触发file,这样的话,提交就会提交2次才可以,如果是为了控制样式的问题,还是选择flash或者js和flash交互好一点