SESSION

<!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>session</title>
</head>
<body>
<button onclick="save()" type="button">点我保存session</button>

<button onclick="get()" type="button">点我读取保存的session</button>
</body>
<script>
function save(){
sessionStorage.setItem("test","我是保存在session的数据")
}
function get(){
alert(sessionStorage.getItem("test"))
}
</script>
</html>
posted @ 2019-06-12 15:15  de玻璃  阅读(97)  评论(0编辑  收藏  举报