如何在 HTML 中更新 Web 儲存空間區域時執行指令碼?


在 HTML 中使用 onstorage 屬性可在 Web 儲存空間區域更新時執行。你可以嘗試執行以下程式碼來實現 onstorage 屬性 −

示例

<!doctype html>
<html>
   <head><title>HTML onstorage</title>
   </head>
   
   <body>
      <h2>Welcome</h2>
      <body onstorage = "javascript:alert('Your learning journey!');">
      Demo text</body>
   </body>
</html>

更新時間: 30-Jul-2019

123 次瀏覽

開啟你的職業生涯

完成課程獲得認證

立即開始
廣告