<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>当我选择了文件,然后提交表单的时候,第一次提交会无效。第二次才会提交。
当我不选择文件的时候,表单会直接提交,请问这里是怎么错了。

解决方案 »

  1.   

    当选择了文件之后,第一下点击'click to submit'
    无法提交
    第二下点击击'click to submit'
    表单提交。
      

  2.   

    如果我把display改为
    style="display:''
    可以看到,当点击dianji.. 选择文件之后,
    再点击 'click to submit'两个控件都被清空了。
      

  3.   

    表单中的调用onSubmit()方法试试!~
      

  4.   

    这种问题估计要问微软了,我用FF CHROME 都不出现该现象唉
      

  5.   

    http://blog.163.com/prevBlogPerma.do?host=hitpanglong&srl=1489482920082124362106&mode=prev
      

  6.   


    <input type='button' name='excel_report_btn' value='dianji..' class="button" style='height:20px' onclick="function(){document.getElementById('excel_report').click();}"/>这样应该可以
      

  7.   

    其实应该还是不行的,
    安全机制的问题,不允许用这种凡是触发file,这样的话,提交就会提交2次才可以,如果是为了控制样式的问题,还是选择flash或者js和flash交互好一点
      

  8.   

     <input type='button' name='excel_report_btn' value='dianji..' class="button" style='height:20px' onclick="document.getElementById('excel_report').click();加上return true;"/>