HTML小技巧:页面刷新后表单中值不丢失[经典]

代码示例:

<html>
<head>
<title>saveHistory行为应用</title>
<meta name="save" content="history">
</head>
<body>
用了saveHistory 行为的表单项:<br>
<INPUT style="behavior:url(#default#savehistory)"><br>
一般表单项:<br>
<input>
</body>
</html>

 注意:<meta name="save" content="history"> 这行代码为必需。

特别说明

saveHistory 默认行为允许对象在浏览器历史中留存数据,相关的特性、事件和方法说明如下:
特性: 
XMLDocument 对对象提供的 XML DOM 的引用。

事件:
onload 页面重载时在持久对象上触发。
onsave 在保存、设置 Web 页为标签或离开该页时从持久对象上触发。

方法:
getAttribute 获取指定属性的值。
removeAttribute 从对象移除指定属性。
setAttribute 设置指定属性的值。

要了解更多关于IE默认行为的资料,可以访问MSDN:
http://msdn.microsoft.com/workshop/author/behaviors/reference/reference.asp
posted on 2006-06-23 17:18  北极熊,我来了!  阅读(2442)  评论(1编辑  收藏  举报