Computing.Net > Forums > Web Development > Google Search Selection

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Google Search Selection

Reply to Message Icon

Name: RTAdams89
Date: June 11, 2006 at 12:16:02 Pacific
OS: na
CPU/Ram: na
Product: na
Comment:

I'm tyring to create a Google search box for my website. I would like something that looks and works similar to this:

http://blog.outer-court.com/archive/2006-01-03-n15.html

Obviously I'll need JavaScript but I was hoping someone already created the necessary code. Anyone?

-Ryan Adams
http://members.cox.net/rtadams89/



Sponsored Link
Ads by Google

Response Number 1
Name: RTAdams89
Date: June 12, 2006 at 12:29:11 Pacific
Reply:

I got it, for thsoe of you interested here is the .js file I made:

function DoSearch() {

if (document.SearchForm.SearchOption.value=="Web") {
var Query = document.SearchForm.SearchBox.value;
var locName = "http://www.google.com/search?hl=en&q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.SearchForm.SearchOption.value=="Images") {
var Query = document.SearchForm.SearchBox.value;
var locName = "http://images.google.com/images?hl=en&lr=&rls=GGLG,GGLG:2005-40,GGLG:en&q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.SearchForm.SearchOption.value=="Groups") {
var Query = document.SearchForm.SearchBox.value;
var locName = "http://groups.google.com/groups?hl=en&lr=&rls=GGLG,GGLG:2005-40,GGLG:en&q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.SearchForm.SearchOption.value=="News") {
var Query = document.SearchForm.SearchBox.value;
var locName = "http://news.google.com/news?hl=en&lr=&rls=GGLG,GGLG:2005-40,GGLG:en&q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.SearchForm.SearchOption.value=="Froogle") {
var Query = document.SearchForm.SearchBox.value;
var locName = "http://froogle.google.com/froogle?hl=en&lr=&rls=GGLG,GGLG:2005-40,GGLG:en&q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.SearchForm.SearchOption.value=="Maps") {
var Query = document.SearchForm.SearchBox.value;
var locName = "http://maps.google.com/maps?lr=&rls=GGLG,GGLG:2005-40,GGLG:en&q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.SearchForm.SearchOption.value=="FileServer") {
var Query = document.SearchForm.SearchBox.value;
var locName = "http://192.168.1.102:4664/search?q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

}

and here is the html form part:

<FORM name="SearchForm">

<BR />
<INPUT type="text" name="SearchBox" size="25" value="Enter search terms..." onClick="value=''"/>

<SELECT name="SearchOption" size="0" onChange="DoSearch()" VALUE="GO">
<OPTION value="">Search...</OPTION>
<OPTION value="Web">Web</OPTION>
<OPTION value="Images">Images</OPTION>
<OPTION value="Groups">Groups</OPTION>
<OPTION value="News">News</OPTION>
<OPTION value="Froogle">Froogle</OPTION>
<OPTION value="Maps">Maps</OPTION>
<OPTION value="FileServer">FileServer</OPTION>
</SELECT>

</FORM>

-Ryan Adams
http://members.cox.net/rtadams89/


0

Response Number 2
Name: bakss
Date: August 9, 2006 at 06:49:21 Pacific
Reply:

see google's cs


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Google Search Selection

signing up for google search accoun www.computing.net/answers/webdevel/signing-up-for-google-search-accoun/273.html

Myspace/Google Search www.computing.net/answers/webdevel/myspacegoogle-search/4133.html

make your site indexing in Google Search eng www.computing.net/answers/webdevel/make-your-site-indexing-in-google-search-eng/4238.html