The search form on this forum can search both the vbulletin and google depending on what you click on.
I want to do this too with my site.
What script did you use to do this?
The search form on this forum can search both the vbulletin and google depending on what you click on.
I want to do this too with my site.
What script did you use to do this?
Here. Hope you enjoy. Just change the details to what you want.
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="http://www.google.com/">
<IMG SRC="http://www.google.com/logos/Logo_40wht.gif"
border="0" ALT="Google"></A>
</td>
<td>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="Google Search">
<font size=-1>
<input type=hidden name=domains value="YOUR DOMAIN NAME"><br><input type=radio name=sitesearch value=""> WWW <input type=radio name=sitesearch value="YOUR DOMAIN NAME" checked> YOUR DOMAIN NAME <br>
</font>
</td></tr></TABLE>
</FORM>
<!-- SiteSearch Google -->
No, i dont want google sitesearch. I think you misunderstood me.
I want ONE search form to be able to have many choices on what you want to search. For example, what this site has. You can choose to search with the vBulletin Search engine or the Google sitesearch engine.
How do you do this?
Try this:
just place that where you want it to appear on your page.Code:<form id="searchForm" action="" method="" onSubmit="sitesearch(this)"> <b>Search:</b><br /> <input id="hiddenquery" type="hidden" name="q"> <input id="hiddenqueryinternal" type="hidden" name="query"> <input type="hidden" name="do" value="process"> <input type="hidden" name="showposts" value="0"> <input type="hidden" name="quicksearch" value="1"> <input type="hidden" name="s" value=""> <input name="searchfor" type="text" style="width: 310px;"> <input type="submit" value="Search" /><br> <div style="font: bold 11px Verdana;"><input name="se" type="radio" checked>Site Search <input name="se" type="radio">Try Google Instead </div> <script type="text/javascript"> function switchaction(curobj, index){ if (index==0){ //if internal document.getElementById("searchForm").action="search.php" document.getElementById("searchForm").method="post" document.getElementById("hiddenqueryinternal").value=curobj.searchfor.value document.getElementById("hiddenquery").value="" } else if (index==1){ //if Google search document.getElementById("searchForm").action="http://www.google.com/search" document.getElementById("searchForm").method="get" document.getElementById("hiddenquery").value=curobj.searchfor.value document.getElementById("hiddenqueryinternal").value="" } } function sitesearch(curobj){ for (var i=0; i< document.getElementById("searchForm").se.length; i++){ //loop through radio to see which is checked if (document.getElementById("searchForm").se[i].checked==true) switchaction(curobj, i) } } </script>
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
The best way would be allow the server to decide, sending a redirect to Google if the user chose that option.
The engine choice would be submitted along with the search terms to the server as normal. If the user chose to use Google, the query would be constructed server-side, and a HTTP redirect would be issued, sending the user to Google. If the built-in search engine was chosen, then the redirect would be skipped and normal processing would resume.
Exactly how one would go about implementing that depends on what server-side programming language you'd want to use (and would be best addressed in the appropriate forum).
Mike
ummm, i want more than just the internal search and google. i wanted to be able to choose search site, arcade, google, blogs, and others.
see my site: http://muslimonline.org
The google one works, but i couldnt get the other ones to work. hmmm, is there any other way? maybe how myspace does it with ajax? (see http://myspace.com)
view http://thetestingsite.net/search.php and see if thats something along the lines of what you need.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
WOW, that search is amazing.
That is REALLY close to what I need. But heres what i need more specifically:
Search for {box here}
Where: {Dropdownmenu here}
The dropdown menu would contain:
Whole Site
Forum
Arcade
Quran
Hadith
This means that when you select something from the dropdown, the javascript or ajax will dynamically change the form action and input name.
Here is an example of 3 of the forms separately right now:
HTML Code:<tr> <form action="http://muslimonline.org/index.php?act=Search&CODE=01&forums=all" method="post" target="_blank"></form> <td align="right"><input name="keywords" onfocus="this.value=''" value="search..." size="20" type="text"></td> <td align="left"><input class="button" value="Site" type="submit"></td> </tr> <tr> <form action="http://www.muslimonline.org/index.php?act=quran&op=search" method="post" target="_blank"></form> <td align="right"><input name="query" onfocus="this.value=''" value="search..." size="20" type="text"></td> <td align="left"><input class="button" value="Quran" type="submit"></td> </tr> <tr> <form action="http://muslimonline.org/cgi-bin/hadith.cgi" method="post" target="_blank"></form> <td align="right"><input onfocus="this.value=''" name="phrase" value="search..." size="20" type="text"></td> <td align="left"><input class="button" value="Hadith" type="submit"> </td> <td valign="middle" width="20"> </td> </tr>
Bookmarks