路由
路由:根据url地址不同,给用户呈现不同的界面(html)
music.html**
<input type="text" id="input" value="你">
<!--
1.如何跳转到search
2.如何传值
-->
<script>
var input = document.getElementById("input");
input.onkeyup = function(event){
if(event.keyCode == 13){
console.log(this.value);
location.href = `search.html?s=${this.value}`
}
}
</script>
search.html
<p>搜索</p>
<script>
console.log(location.search.split("=")[1])
var keyword = location.search.split("=")[1];
var c = decodeURIComponent(keyword);
console.log(c);
</script>