I have a search box that I want javascript to open in a new window a google custom search enginne but pass the keyword from my site.
<form name="myform">
<input type="text" name="search_text" id="search_text"> <input type="button" name="search" onclick="goSearch()">
</form>
<script>
function goSearch() {
var st = document.getElementById('s
earch_text
').value;
window.open('
https://www.google.com/cse/publicurl?cx=016143464297381313748:e13kxohrq8s' + st);
}
</script>
Firebug indicates the element ID is null. How do I capture the data for "search_text" with the onclick?
Open in new window