Ok, this should be easy but for me it doesn't seem so... probably because i'm very close to the deadline and have a lot to do.
This is what i'm trying to do; I have an html form with a textfield and a button - whenever the button is clicked or enter is pressed i would like it to goto a particul开发者_高级运维ar page with the text field's value on the end as a hash.
for instance; user enters "test" and presses enter or hits the button and the page goes to "google.com#test"
<html>
<head>
<script type="text/javascript">
function do_it() {
var hash = document.getElementById("hash_input").value;
window.location = "http://google.com#"+hash;
}
</script>
</head>
<body>
<input id="hash_input" type="text"></input>
<input type="button" onclick="do_it()" value="Go"></input>
</body>
</html>
精彩评论