源文件已经指定,例如:var sPath = "c:\\ccb\\txrem.txt";     
大概过程是这样:点击按钮-->弹出另存为对话框-->选择要保存的路径-->保存文件

解决方案 »

  1.   

    文件操作 , 用fso , 需要降低ie安全级别
      

  2.   

    fso是要指定保存路径的吧.我要的是可以在对话框自由选择保存路径的那种效果
      

  3.   

    选择要保存的路径--> 你可以用<input type=file name=file1>来模拟,
    JS默认权限是无法使用FSO对像,如果一定要用的话要降低IE安全级别,
      

  4.   

    <object id="fileDialog" width="0px" height="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://activex.microsoft.com/controls/vb5/comdlg32.cab"> 
    </object> 
    <textarea id=TxtBody style="background-color:#EEEEEE;width:100%;height:100">无标题</textarea> 
    <br> 
    <input type=button value=加载 onclick="loadDoc()"> 
    <input type=button value=保存 onclick="saveDoc()"> 
    <script> 
    function loadDoc() 

    fileDialog.CancelError=true; 
    try{ 
    fileDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt"; 
    fileDialog.ShowOpen(); 
    var fso=new ActiveXObject("Scripting.FileSystemObject"); 
    var reading=1; 
    var f=fso.OpenTextFile(fileDialog.filename,reading); 
    //window.confirm(f); 
    var r=f.ReadAll(); 
    f.close(); 
    TxtBody.value=r; 
    }catch(e){} 

    function saveDoc() 

    fileDialog.CancelError=true; 
    try{ 
    fileDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt"; 
    fileDialog.ShowSave(); 
    var fso=new ActiveXObject("Scripting.FileSystemObject"); 
    var f=fso.CreateTextFile(fileDialog.filename,true); 
    f.write(TxtBody.value); 
    f.Close(); 

    catch(e){} 

    </script> 
    </body> 
    这段程序在xp系统下可以正常运行。
      

  5.   

    <script>
    function hehe()
    {
        var filePath = document.getElementById("filePath"); 
        alert(filePath.value);
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        var f1 = fso.CopyFile("c:\\Test.txt", "c:\\logs\\");
    }
    </script>
    <input type="file" id="filePath" />
    <input type="button" value="Test" onclick="hehe();" />只能指定路径,由于input type="file"无法选择文件夹,期待高手回答