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

Google Search Selection

Reply to Message Icon

Original Message
Name: RTAdams89
Date: June 11, 2006 at 12:16:02 Pacific
Subject: Google Search Selection
OS: na
CPU/Ram: na
Model/Manufacturer: 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/


Report Offensive Message For Removal


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

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/


Report Offensive Follow Up For Removal

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

see google's cs


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Google Search Selection

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge