The google search URL is basically: https://www.google.com/search?q=[query]
Using that you can easily build a search URL to navigate to, f.ex using a simple form without javascript:
<form action="http://google.com/search" target="_blank">
<input name="q">
<input type="submit">
</form>
Demo: http://jsfiddle.net/yGCSK/
If you have the search query in a javascript variable, something like:
<button id="search">Search</button>
<script>
var q = "Testing google search";
document.getElementById('search').onclick = function() {
window.open('http://google.com/search?q='+q);
};
</script>
Demo: http://jsfiddle.net/kGBEy/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…