用html5的localStorage方法就可以实现本地存储
<!DOCTYPE html>
<html lang="en" xmlns="
http://www.w3.org/1999/xhtml"><head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div>name<input type="text" /></div>
<div>age<input type="text" /></div>
<div><input type="submit" /></div>
<script>
document.getElementsByTagName("input")[2].onclick = function () {
var _name = document.getElementsByTagName("input")[0].value
var _age = document.getElementsByTagName("input")[1].value
localStorage.setItem("name", _name);
localStorage.setItem("age", _age);
}
</script>
</body>
</html>
需要配置服务端,本地运行无效