<form name=form1>
<span style="width: 230; overflow: hidden;">
<input type="file" name="file1" style="width: 300;">
</span>
<input type=button value=浏览 onclick="document.form1.file1.click()">
</form>

解决方案 »

  1.   

    majiming(百死不得其姐) 请问,我要选中以后自动submit怎么办? 我在<input type="file" onchange="document.form1.submit();" 这样怎么不正确,帮我看看,谢谢
      

  2.   

    <form name="form1" action="jsp2.jsp">
    <span style="width: 0; overflow: hidden;">
        <input type="file" name="file1" style="width: 300;" onchange="document.forms[0].submit();">
    </span><input type="submit" value="aaa" onclick="document.form1.file1.click();">
    </form>
    这样为什么不正确
      

  3.   

    不要动这个歪脑筋了, MS早就把这个洞补上了. 你通过脚本触发type=file选中的文件根本就不能上传
    正确的做法你可以document.createElement()创建出<input type=file>对象, 让用户一个个点击选中文件再上传.
      

  4.   

    meizz(梅花雪)说得不错。你或者用Div与IFrame结合来做,把它绕过去。
      

  5.   

    你俩个答的也不对,有一个组件,当然权限要自己调节可以提供api的Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
    Public Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
      

  6.   

    还有如果还有什么不懂的也可以参考http://dev.csdn.net/article/60/60487.shtm他的几种方法