HTML Google Search

By Weasel on Dec 27, 2009

First of all. This is JAVASCRIPT, this will not work on Wordpress! So, users can input search parameters (EG. Script Codes) then it would redirect the current page to google then search the inputed text.

I am working on a website where i post scripts called ScriptFreak
you can download a zip or see the preview (Under /Scripts/Google Search Box)

Enjoy!

<html>
<body>

<script type="text/javascript">
function google()
{
var str=document.getElementById('googlebox').value;
str="http://www.google.com/search?hl=en&source=hp&q=" + str + "&aq=f&oq=&aqi=";
var replaced=str.replace(" ","+");
window.location.replace(replaced)
}
</script>
<input type="text" value="Google" id="googlebox"/>
<input type="button" value="Go" onclick="google()"/>
</body>
</html>

Comments

Sign in to comment.
gooshie   -  Dec 27, 2009

&source=hp is just giving credit to
Hewlett-Packard for the redirect..
(from now on let's do &source=Hawkee)

You could do simply this:

<form method="get" action="http://www.google.com/search">
<input value="" name="q" />
<input type="hidden" value="en" name="hl" />
<input type="hidden" value="lang_en" name="lr" />
<input type="button" value="Search" onclick="submit()" />
</form>
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.