在搜索框中输入数字( index.html )并放入href链接
(search-pincode.html)在<span>
标记 中 - 我在输入 search-pincode.html 时获得了搜索框值但是当我从 index.html 页面尝试时它不起作用。没运气 !任何帮助赞赏!提前谢谢。
HTML(index.html)
<form class="form1" role="search" method="get" action="search-pincode.html">
<input class="pincode1" type="number" placeholder="Enter Postcode" id="user-pincode">
<button class="submit" type="button" onclick="myFunction()">Check</button>
</form>
JS
<script>
function myFunction() {
var x = document.getElementById("user-pincode").value;
document.getElementById("user-pincode-show").innerHTML = x;
}
</script>
输出:search-pincode.html
<h1 class="search-h1-contact">Yes, we install CCTV in <span id="user-pincode-show"></span></h1>