<body><input type="text" id="app"><script>/* 1、点击键盘的enter,获取input的值 */var app = document.getElementById("app")app.onkeydown= function(event){if(event.keyCode==13){console.log(this.value)/* 2、将这个值传递给另一个页面 */location.href = "15search.html?s="+this.value;}}</script>location.href =" " // 跳转到另一个页面location.search // 可设置或返回当前 URL 的查询部分(问号 ? 之后的部分)decodeURIComponent() //解码
