HTML小技巧:頁面重新整理後表單中值不丟失[經典]

來源:互聯網
上載者:User
程式碼範例:

<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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.