跟着你的思路做可以这样:
w=window.open("", "", "left=1800,height=1000");
w.document.write(rsaCer);

w.document.execCommand("SaveAs",true,"个人私钥.txt");
w.close();我这边好像要把w.close()放在后面才行

解决方案 »

  1.   

    w.close()是应该放后面我写错的,你的方法打开了一个很大的页面,我现在不想看到这个新开的窗口;在描述一下:有没有办法将一段文字或者剪贴板上假设有了这些文字,有什么么办法可以先让用户输入文件名,选择好保存路径(就像windows另存为),然后将获得这个文件存放路径和名称
    因为有一个办法,可以实现保存:
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var f = fso.CreateTextFile(存放路径及文件名);
    f.WriteLine('你要写入的内容');
    f.close();缺点是路径是死的,不能和用户交互或者谁知道如何创建一个隐藏窗口
    请高手多多赐教!!
      

  2.   

    不会吧,left=1800,height=1000还能看见?你屏幕分辨率多少的啊?
    试试这句:
    w=window.open("", "", "width=10,height=10,left=1800,height=1000");
      

  3.   

    不需要放到剪贴板上啊,把有可能要保存的文字放在div里
    <div id="div1">要保存的文字</div>f.WriteLine(div1.innerHTML);
      

  4.   

    <input type=button value=另存为 name="rsa" onclick="test()">
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function test(){
    document.body.insertAdjacentHTML("beforeEnd","<iframe name=aaa id=aaa></iframe>");
    aaa.document.write("123 asdf asdf asdf asf dasdf");
    aaa.document.close();
    aaa.document.execCommand('saveas','true','个人私钥.txt');
    document.all("aaa").removeNode(true);
    }
    //-->
    </SCRIPT>
      

  5.   

    <input type=button value=另存为 name="rsa" onclick="test()">
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function test(){
    document.body.insertAdjacentHTML("beforeEnd","<iframe name=aaa id=aaa></iframe>");
    aaa.document.write("123 asdf asdf asdf asf dasdf");
    aaa.document.close();
    aaa.document.execCommand('saveas','true','个人私钥.txt');
    document.all("aaa").removeNode(true);
    }
    //-->
    </SCRIPT>
      

  6.   

    myhyli很好,你说的完全可以实现,能不能帮我说明一下,两个地方:
    document.body.insertAdjacentHTML("beforeEnd","<iframe name=aaa id=aaa></iframe>");
    这个方法和参数
    document.all("aaa").removeNode(true);等你回复好结贴!!
      

  7.   

    还有myhyli,有没有什么email,qq,popo,msn等的联系方式,以后多多指教,我在北京
      

  8.   

    就是在页面上临时插入一个iframe,利用iframe去单独执行保存页面的操作,然后在保存完毕以后删除掉这个临时的iframe