location.href =" " // 跳转到另一个页面location.search // 可设置或返回当前 URL 的查询部分(问号 ? 之后的部分)decodeURIComponent() //解码
<input type="text" name="" id="input"><script>var input=document.getElementById("input");input.onkeydown=function(event){if(event.keyCode==13){console.log(this.value)location.href=`search.html?s=${this.value}`}}</script>
<p>搜索</p><script>console.log(location.search.split("=")[1]);var keyword=location.search.split("=")[1];var c=decodeURIComponent(keyword);//将进制数据转为文本console.log(c);</script>
