SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Apr 22, 2001, 19:30 #1
- Join Date
- Jan 2001
- Location
- Canada
- Posts
- 140
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I don't know if you have seen one but I have seen some sites that have a search box but beside the search box they have a drop down menu where you can select if you want to search just their site of the entire internet.
I don't know anything about javascript so i would really appreciate a some help.
Here is my specs:
my site is searchable using atomz.com
i want to search the web through google.com
and i have a searchable yahoo style directory that has it's own search box
basically i want to merga all 3 and make it into one search box with a drop down menu
thanks in advance.Ali Memon
Direct Print
-
Apr 22, 2001, 19:50 #2
- Join Date
- Apr 2001
- Location
- Toronto, Ontario, Canada, Earth
- Posts
- 138
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i think this is what you're looking for:
Code:<script language=JavaScript> function Array1() { this.length = Array1.arguments.length; for(var i = 0; i < this.length; i++) { this[i+1] = Array1.arguments[i]; } } var engines = new Array1 ( "http://www.google.com/search?q=", "http://www.altavista.com/cgi-bin/query?q=" ); function search(form) { var term = escape(form.query.value); var eng = parseInt(form.engine.selectedIndex); window.location.href = engines[eng+1] + term; } </script> <form method=POST action=""> <input type=text name=query value="" size=20><BR> <select name=engine> <option>Google <option>Altavista </select> <input type=button value=Search onClick="search(this.form)"> </form>
hope this helps,
Jason Weinstein
webmaster@MaximumEdge.com
http://www.MaximumEdge.com/
-
Apr 23, 2001, 22:02 #3
- Join Date
- Jan 2001
- Location
- Canada
- Posts
- 140
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
sorry to bother but...
The script works great except for one thing
my site uses atomz.com for local site search
here is the problem
atomz.com search gives me an error unless the text field where the search term is entered is named "sp-q"
but when i put that in
var term = escape(form.sp-q.value);
and i also change <input type=text name=sp-q value="" size=20>
well i guess the sp-q isn't acceptable because the "-" throws the script offAli Memon
Direct Print
-
Apr 24, 2001, 06:55 #4
- Join Date
- Apr 2001
- Location
- Toronto, Ontario, Canada, Earth
- Posts
- 138
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hello,
all you have to do is add another option on the form, and another value for the search engines URLs. don't change anything else. here's my example again with the site point atomz search engine integrated into it:
Code:<script language=JavaScript> function Array1() { this.length = Array1.arguments.length; for(var i = 0; i < this.length; i++) { this[i+1] = Array1.arguments[i]; } } var engines = new Array1 ( "http://www.google.com/search?q=", "http://www.altavista.com/cgi-bin/query?q=", "http://search.atomz.com/search/?sp-a=00082152-sp00000000&sp-q=" ); function search(form) { var term = escape(form.query.value); var eng = parseInt(form.engine.selectedIndex); window.location.href = engines[eng+1] + term; } </script> <form method=POST action=""> <input type=text name=query value="" size=20><BR> <select name=engine> <option>Google <option>Altavista <option>Atomz.com </select>
Jason Weinstein
webmaster@MaximumEdge.com
http://www.MaximumEdge.com/
-
Apr 24, 2001, 18:17 #5
- Join Date
- Jan 2001
- Location
- Canada
- Posts
- 140
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
just this last question
don't mean to sound unthankful but I am also searching a link indexing cgi script
this cgi scirpt does not get it's variables from the url query
it uses something called &GetFormInput
here is the regualr code i use when searching that directory
<form method="POST" action="http://www.yourdomain.com/cgi-bin/search.cgi?action=search">
<p align="center">Search For: <input type="text" name=search size="20"></p>
<p align="center"><input type="submit" value="Search" name="B1"></p>
</form>
would really appreciate this last help.
Ali Memon
Direct Print
Bookmarks