//在history.back()的时候文本框里的信息不会丢失 <!-- Tell the browser the page is persistent--> <META NAME="save" CONTENT="history"> <!-- Define the class for the persistent object--> <STYLE> .saveHistory {behavior:url(#default#savehistory);} </STYLE><!-- The default behavior is to persist form elements. When the saveHistory behavior is defined, form elements will not persist unless they have a class. --> This persists:<INPUT TYPE="text" CLASS="saveHistory"> This does not persist:<INPUT TYPE="text"><p> <A HREF="http://www.meizz.com">点一下然后用浏览器返回按钮返回</A>
//将用户在文本框里的输入信息在用户另存页面时一起保存 <!-- Tell the browser the page is persistent--> <META NAME="save" CONTENT="snapshot"> <!-- Define the class for the persistent object--> <STYLE> .saveSnapshot {behavior:url(#default#savesnapshot);} </STYLE><!-- When the page is saved, the information entered in the persistent form element will be inserted as the value within the HTML file.--> <INPUT TYPE=text CLASS=saveSnapshot ID=oPersistInput>
<!-- Tell the browser the page is persistent-->
<META NAME="save" CONTENT="history">
<!-- Define the class for the persistent object-->
<STYLE>
.saveHistory {behavior:url(#default#savehistory);}
</STYLE><!-- The default behavior is to persist form elements.
When the saveHistory behavior is defined, form elements
will not persist unless they have a class.
-->
This persists:<INPUT TYPE="text" CLASS="saveHistory">
This does not persist:<INPUT TYPE="text"><p>
<A HREF="http://www.meizz.com">点一下然后用浏览器返回按钮返回</A>
<!-- Tell the browser the page is persistent-->
<META NAME="save" CONTENT="snapshot">
<!-- Define the class for the persistent object-->
<STYLE>
.saveSnapshot {behavior:url(#default#savesnapshot);}
</STYLE><!-- When the page is saved, the information entered in the
persistent form element will be inserted as the value
within the HTML file.-->
<INPUT TYPE=text CLASS=saveSnapshot ID=oPersistInput>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style>
body
{
behavior:url(#default#userdata);
}
</style>
</HEAD><BODY>
先点击test,动态生成innerHTML,点击link to other uri,再点击后退,可以看到动态innerHTML依然存在。
<SCRIPT LANGUAGE="JavaScript">
<!--
var a=document.body;
function fnSave()
{
a.setAttribute("content", document.body.innerHTML);
a.save("sValue");
}
function fnLoad()
{
a.load("sValue");
if(a.getAttribute('content')!=null)
{
a.innerHTML=a.getAttribute('content');
}
}
function fntest()
{
document.getElementById("el").innerHTML="blueDestiny, never-online";
}
window.attachEvent('onbeforeunload',fnSave);
window.attachEvent('onload',fnLoad);
//-->
</SCRIPT>
<input id="1">
<input id="2">
<p>
<div id="el"></div>
</p>
<a href='http://blog.csdn.net/bluedestiny'>link to other uri</a>
<button onclick="fntest()">test</button>
</BODY>
</HTML>