可以模拟一个file
就是
左边是input[text]
右边是input[file]
然后右边的z-index比左边的小。
margin:负值
这样
右边的file
的文本部分就被左边的text给盖住了。

解决方案 »

  1.   

    安全问题,file字段不能赋值。在本机应用可以,htm改成hta。
      

  2.   

    就算用div模拟了,你提交时也不能获得file1的值(为空),除非你重新选择过file1
      

  3.   

    大概是这样的...
    不过,你要是想给file加默认值是不可能的..<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <div style="position:relative;">
        <input id="wc" type="text" name="file" style="position:relative;z-index:2; background-color:#CCCCCC;" />
        <input type="file" style="position:absolute;z-index:1;left:0;" onchange="document.getElementById('wc').value = this.value" />
    </div>
    </body>
    </html>仔细看了下你的需求,貌似,只是把file1和file2换下位置那么简单 - -