怎么把文本框中的内容保存成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();浏览器可能需要一定的权限才能进行以上操作 转译问题 Extjs中Grid问题 jquery $.getjson() C/S系统页面刷新问题 在原有结构中插入一个div的问题 急求一正則表達式,在綫等 javascript的数组最大长度是多少? 关于验证文本框的问题,菜鸟求救啊! 邀请各路高手进来看看:让浏览器在窗口底部提示; 呼唤高手!(javascript 定时器) 请教高手,如何替换超文本标签? 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();浏览器可能需要一定的权限才能进行以上操作