http://www.xici.net/d7871540.htm

保存文本框中的内容到硬盘为Txt文件的JS方法

 
离线
 woderoom [角落] [飞语] 发表于:02-12-04 20:37 [只看该作者]
 
<textarea id=t1>需要保存的内容在这里</textarea>
<input type=button value=保存 onclick=save()>
<iframe id=f1 style=dispaly:none></iframe>
<script language="JScript">
function save(){
 f1.document.write(t1.value);
 f1.document.execCommand("SaveAs",false,"test.txt");
 }
</script>