怎么把文本框中的内容保存成html文件? window.open之后 document.execCommand('SaveAs','xxx.htm'); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <input type="text" id="txt"/><input type="button" onclick="SaveAs()" value="Save"/><iframe name="IF" id="IF" style='display:none'></iframe><script type="text/javascript">function SaveAs(){ var v=document.getElementById('txt').value; var doc=document.frames("IF").document; doc.write(v); doc.execCommand('SaveAs','a.htm'); doc.body.innerHTML="";//清除原来的内容 //doc.location.reload();}</script> <input type="text" id="txt"/><input type="button" onclick="SaveAs()" value="Save"/><iframe name="IF" id="IF" style="display:none"></iframe><script type="text/javascript">function SaveAs(){ var v=document.getElementById('txt').value; var doc=document.frames("IF").document; doc.write(v); doc.execCommand('SaveAs','a.htm'); //doc.body.innerHTML="";//清除原来的内容 doc.location.reload();//还是用这个来清除,上面的清除不了,晕}</script> var fd = new ActiveXObject("MSComDlg.CommonDialog");fd.Filter = "Text File(*.txt)|*.txt";fd.FilterIndex = 2;fd.MaxFileSize = 128;fd.ShowSave();fso=new ActiveXObject("Scripting.FileSystemObject"); f1=fso.CreateTextFile(fd.filename,true); f1.WriteLine(txtID.innerText); //txtID为文本框id f1.Close();浏览器可能需要一定的权限才能进行以上操作 js 0-9随机数? jquery制作二级导航菜单问题 Ext表格嵌套,选择嵌套表格行问题,求解! 提示一个jQuery的问题 一个function使用计时器进行循环,怎么才能在另一个function中停止计时器计时?? 求javascript延时关闭窗口的方法 关于点击按钮 提交两个参数的问题 如何让按钮或图片按钮点击后成为当前页?????? 这一行的Button变量不能得到,可能是语法错误,哪个能写正确的? js取多个text值传后台问题 请教高手,如何替换超文本标签? Jscript调用存储过程怎么传多个参数?
<input type="button" onclick="SaveAs()" value="Save"/>
<iframe name="IF" id="IF" style='display:none'></iframe>
<script type="text/javascript">
function SaveAs()
{
var v=document.getElementById('txt').value;
var doc=document.frames("IF").document;
doc.write(v);
doc.execCommand('SaveAs','a.htm');
doc.body.innerHTML="";//清除原来的内容
//doc.location.reload();
}
</script>
<input type="button" onclick="SaveAs()" value="Save"/>
<iframe name="IF" id="IF" style="display:none"></iframe>
<script type="text/javascript">
function SaveAs()
{
var v=document.getElementById('txt').value;
var doc=document.frames("IF").document;
doc.write(v);
doc.execCommand('SaveAs','a.htm');
//doc.body.innerHTML="";//清除原来的内容
doc.location.reload();//还是用这个来清除,上面的清除不了,晕
}
</script>
fd.Filter = "Text File(*.txt)|*.txt";
fd.FilterIndex = 2;
fd.MaxFileSize = 128;
fd.ShowSave();
fso=new ActiveXObject("Scripting.FileSystemObject");
f1=fso.CreateTextFile(fd.filename,true);
f1.WriteLine(txtID.innerText); //txtID为文本框id
f1.Close();浏览器可能需要一定的权限才能进行以上操作