跟着你的思路做可以这样:
w=window.open("", "", "left=1800,height=1000");
w.document.write(rsaCer);
w.document.execCommand("SaveAs",true,"个人私钥.txt");
w.close();我这边好像要把w.close()放在后面才行
w=window.open("", "", "left=1800,height=1000");
w.document.write(rsaCer);
w.document.execCommand("SaveAs",true,"个人私钥.txt");
w.close();我这边好像要把w.close()放在后面才行
因为有一个办法,可以实现保存:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.CreateTextFile(存放路径及文件名);
f.WriteLine('你要写入的内容');
f.close();缺点是路径是死的,不能和用户交互或者谁知道如何创建一个隐藏窗口
请高手多多赐教!!
试试这句:
w=window.open("", "", "width=10,height=10,left=1800,height=1000");
<div id="div1">要保存的文字</div>f.WriteLine(div1.innerHTML);
<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>
<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>
document.body.insertAdjacentHTML("beforeEnd","<iframe name=aaa id=aaa></iframe>");
这个方法和参数
document.all("aaa").removeNode(true);等你回复好结贴!!