Check out the Google Custom Search Engine , which will create these code snippets for you.
According to this anatomy of the query string , you can simply add another parameter instead of adding site:xyz to the search string:
<form method="GET" action="//www.google.de/search"> <input type="hidden" name="as_sitesearch" value="http://example.com"> <input type="text" name="q"> <input type="submit" value="Search!"> </form>
No need to use JavaScript for a simple search form.
Bergi source share