首页 > 代码库 > 用本地存储输出用户名和年龄

用本地存储输出用户名和年龄

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>存储输出</title>
<script type="text/javascript">
 if(window.localStorage){
     alert("支持");
     window.localStorage.setItem(‘name‘,‘张三‘);
     window.localStorage.setItem(‘age‘,‘19‘);
     alert(window.localStorage.getItem(‘name‘));
     alert(window.localStorage.getItem(‘age‘));
     }else{
         alert("不支持");
         }
</script>
</head>

<body>
</body>
</html>

用本地存储输出用户名和年龄