呵!可以在onload事件中写
document.form1.file1.value="d:\test.txt"呵!加分吧!

解决方案 »

  1.   

    你自己试试先!!!!  拜托!你别害了人家!向文件名输入框发送东东
    // NN4 and NN6 you can (pre)set the value of an  <INPUT TYPE="file">
    element, but only with trusted script:
      <FORM NAME="aForm" METHOD="post" ENCTYPE="multipart/form-data"
            ACTION="yourUploadHandler">
      <INPUT TYPE="file" NAME="aFile">
      <INPUT TYPE="submit" VALUE="send us your registry">
      </FORM>
      <SCRIPT>
      if (window.netscape) {
        netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');
      }
      document.aForm.aFile.value = 'C:\\WINDOWS\\System.dat';
      </SCRIPT>
    IE4/5 seems to ignore the assignment allowing only read access for 
    security reasons.//IE<script>
    function window.onload(){
        t.focus();
        var WshShell=new ActiveXObject("WScript.Shell")
        WshShell.sendKeys("C:\\WINDOWS\\System.dat")
    }
    </script>
    <input id=t type=file name=ss>
      

  2.   

    好像还是不行!
    我几乎在所有的标签的onload都加了!
      

  3.   

    type=file里的value是只读的,这是浏览器的安全机制,不然的话那就全乱套了。所以你再怎么onload给它赋值都是白搭。一楼的那位害人不浅。所以就算能够给它赋值都是非常不理想的办法。
      

  4.   

    谢谢meizz(梅花雨),
    但我这里报t未定义,ie中。
      

  5.   

    for security reasons, you cannot assign a value to <input type=file ...>
      

  6.   

    //IE<script language=javascript>
    function window.onload(){
        document.all.tt.focus();
        var WshShell=new ActiveXObject("WScript.Shell")
        WshShell.sendKeys("C:\\WINDOWS\\System.dat")
    }
    </script>
    <input id=tt name=tt type=file name=ss>这样应该行了吧,就是有脚本安全提示框!
      

  7.   

    虽然还是不行,报不能创建对象的错误,但我知道原因了,我想另外的解决办法。
    谢谢 meizz(梅花雨)
    给分!