<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
// 设置本地储存信息
localStorage.setItem("username", "John");
// 获取本地储存信息
alert("username = " + localStorage.getItem("username"));
</script>
</body>
</html>
想要的结果.png
网友评论