1、在现在文档中写表单,提交用户输入信息
<form action="index.html">
输入用户名:<input type="text" name="uname">
<input type="submit" value="登录">
</form>
2、在提交的index页面中获取并展示用户输入信息
<style>
span {
color: red;
}
</style>
<body>
<div>
Welcome <span></span>
</div>
<script>
var address = location.search;
console.log(address);
var uname = address.substr(1, address.length - 1);
var fullname = uname.split('=');
var guest = document.querySelector('span');
guest.innerHTML = fullname[1];
</script>
</body>