I want to pass the search query from one html page text box to another html page text box using cookies.
I have tried the following script but it is not working as expected:
Page 1
<input type="text" value="" name="s" id="s1" />
<input id="btnSave" type="button" value="Search" onclick="Redirect();"/>
<script type="text/javascript">
function Redirect() {
var x = document.getElementById("s1").value;
document.cookie = x;
window.location.href = 'Result.html';
}
</script>
Page 2
<script>
function getcookie() {
document.getElementById("#s").value = document.cookie;
}
</script>
<body onload="getcookie();">
<input id="s" type="text" />
</body>