我想不提交Server可以通过[另存为...]保存当前页面和填写的内容

三杯倒 2005-08-12 08:52:41
我想通过[IE->文件->另存为...]保存当前页面,同时保存当前页面填写内容。但是不论我怎么写程序,表单填写的内容会消失,我想不提交Server可以通过[另存为...]保存当前页面和填写的表单内容。
...全文
137 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
安迪 2005-08-12
  • 打赏
  • 举报
回复
还是有漏掉的:
<input type="hidden" name="hdn" value=''>
改成:
<input type="hidden" name="hdn" value="1">
cxz7531 2005-08-12
  • 打赏
  • 举报
回复
换这个方法就可以了
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<script>
function savefile(){ //保存文件函数
var contentstr=document.documentElement.outerHTML
savepage.document.clear();
savepage.document.open();
savepage.document.write(contentstr);
savepage.document.execCommand('SaveAs',false,"a.htm");
savepage.document.clear();
savepage.document.close()
}
</script>

</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="text" name="T1" size="20"><input type="button" value="保存当前页面" name="B1" onclick="savefile();"><input type="reset" value="全部重写" name="B2"></p>
</form>
<iframe id=savepage src="about:blank" style="display:none"></iframe> <!--实现保存-->
</body>

</html>
安迪 2005-08-12
  • 打赏
  • 举报
回复
小弟学艺不精,上边的程序,有严重的bug,再发一次!这个是我左拼右凑的,希望好使:
//////////////////////////////////////////////////////////////////////
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<Script language="javascript">
<!--
function fncSource()
{
if (document.all.hdn.value==1)
{
document.write(document.documentElement.outerHTML);
}
document.execCommand('Saveas',true,'c:\\test.htm');
document.all.hdn.value="2";
}
//-->
</Script>
</head>
<body>
<input type="button" name="save" value='save' onclick="fncSource()">
<input type="text" name="txt" value=''>
<input type="hidden" name="hdn" value=''>
</body>
</html>
安迪 2005-08-12
  • 打赏
  • 举报
回复
看看这个办法也许行的通吧??(纯属猜测----根据孟子老大以前给的代码)
///////////////////////////////////////////////////////////
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<Script language="javascript">
<!--
function fncSource()
{
document.write(document.documentElement.outerHTML);
}
//-->
</Script>
</head>
<body>
<input type="button" name="save" value='save' onclick="document.execCommand('Saveas',false,'c:\\test.html')">
<input type="text" name="txt" value='' onBlur="fncSource()">
</body>
</html>
bflovesnow 2005-08-12
  • 打赏
  • 举报
回复
关注.
孟子E章 2005-08-12
  • 打赏
  • 举报
回复
参考
http://msdn.microsoft.com/workshop/author/persistence/overview.asp
bguest 2005-08-12
  • 打赏
  • 举报
回复
暂时没什么好办法,关注。用js操作文件来记录有点烦,也不安全。

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧