type=file是只读控件,考虑安全性的问题,是不允许直接赋值的

解决方案 »

  1.   

    <input id=a size=20><button>选择文件</button>
    <div style="position:absolute;top:11px;left:-71px;width:150;filter:alpha(opacity=0)" >
      <input name="file" type="file" size=33 onpropertychange="a.value=this.value">
    </div>
      

  2.   

    如果你非要赋值的话,可以考虑Wscript.shell模拟触发键盘事件,哈哈
      

  3.   

    <script language=javascript>
    function window.onload()
    {
        test.focus();
        var WshShell=new ActiveXObject("WScript.Shell"); //会有安全提示
        WshShell.sendKeys("c:\\test.txt"); //向文本框里发送东东
    }
    </script>
    <input name=test type=file>强制试试!