对file框赋值是不允许的,除非用控件,但会出现提示:
请参照下面:在你的photo1在加onchange,然后对路径处理赋给你它file
<script language=javascript>
function window.onload()
{
    meizz.focus();
    var WshShell=new ActiveXObject("WScript.Shell"); //会有安全提示
    WshShell.sendKeys("c:\\test.txt"); //向文本框里发送东东
}
</script>
<input name=photo2 type=file>

解决方案 »

  1.   

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

  2.   


    好像不行呢!//这是那个函数
    function setOtherFile()
    {
        var filePath;
         filePath = document.frm.photo1.value;
         photo2.focus();
         var WshShell=new ActiveXObject("WScript.Shell"); //会有安全提示
         WshShell.sendKeys(filePath); //向文本框里发送东东
    }//这是我的其中的两个<input><tr bgcolor="#FFFFFF" height="35" >   
    <td ><input type="file" name="photo1" size=65 onchange="setOtherFile 
                    ()" />&nbsp;(20*20)</td>
    </tr>
    <tr bgcolor="#FFFFFF" height="35">   
        <td ><input type="file" name="photo2" size=65 />&nbsp;(20*24)</td>
    </tr>
    请问是上面我的是对的吗?如果是对的,那么不行呢, 
    呜还请各位高手帮忙啊!!!!
      

  3.   

    这个样子倒是可以实现,不过可能安全性上有问题,你看看吧<SCRIPT language="javascript">
    function test(str)
    {
    var preValue = str;
    var arrValue = preValue.split(".");
    document.all.inputFile1.value = arrValue[0].substring(0,arrValue[0].length-2) + "1." + arrValue[1];
    document.all.inputFile2.value = arrValue[0].substring(0,arrValue[0].length-2) + "2." + arrValue[1];
    document.all.inputFile3.value = arrValue[0].substring(0,arrValue[0].length-2) + "3." + arrValue[1];
    document.all.inputFile4.value = arrValue[0].substring(0,arrValue[0].length-2) + "4." + arrValue[1];
    }
    </SCRIPT>
    <BODY>
    <input type=file id=fileId0 style="display: none" onPropertyChange="inputFile0.value=value">
    <input name=inputFile0 onPropertyChange="test(this.value)"><input type=button value=' 浏 览 ' src="" onclick="fileId0.click()"><br><br><input type=file id=fileId1 style="display: none" onPropertyChange="inputFile1.value=value">
    <input name=inputFile1><input type=button value=' 浏 览 ' src="" onclick="fileId1.click()"><br><br><input type=file id=fileId2 style="display: none" onPropertyChange="inputFile2.value=value">
    <input name=inputFile2><input type=button value=' 浏 览 ' src="" onclick="fileId2.click()"><br><br><input type=file id=fileId3 style="display: none" onPropertyChange="inputFile3.value=value">
    <input name=inputFile3><input type=button value=' 浏 览 ' src="" onclick="fileId3.click()"><br><br>
    <input type=file id=fileId4 style="display: none" onPropertyChange="inputFile4.value=value">
    <input name=inputFile4><input type=button value=' 浏 览 ' src="" onclick="fileId4.click()"><br><br>
    </BODY>