首页 > 文章列表 > 当HTML中的Web存储区域更新时执行脚本吗?

当HTML中的Web存储区域更新时执行脚本吗?

HTML 脚本执行 Web存储
487 2023-09-15

使用HTML中的onstorage属性来执行Web存储区域的更新。您可以尝试运行以下代码来实现onstorage属性 −

Example

的中文翻译为:

示例

<!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>