|
|
How do I build a multi-site search box?If I have a Google web search form placed in my site, how can I set it up so that there is one input box (for the web search) but two submit buttons - one for a web 'text' search, and one for a google image search? Is that even doable?? That's not terribly difficult to accomplish, actually, and it's quite informative for people seeking to experiment with feeding a search pattern to more than one search engine too. First off, here's the form at work: And here's the source for that form, in XHTML: <form target="_blank" name="googleForm" method="get"
action="http://www.google.com" style="border:1px solid black;padding:8px;"> <input type="text" name="q" size="40" maxlength="255" value="" /><br /> <input type="submit" value="Google Search!" onClick="document.googleForm.action='http://www.google.com/search';" /> <input type="submit" value="Google Images!" onClick="document.googleForm.action='http://www.google.com/images';"> </form> See how that works? All you need to do is change the action value of the form through a tricky little bit of JavaScript. There's no reason you couldn't use this very same techinque to have a search engine box on your site, for example, that could send the same query to a number of different search engines (though you need to ensure that they all expect the search term to have the same variable name). Hope this helps! My thanks to Jason M. Hurst Frye for his help with this snippet of HTML.
More Useful HTML, JavaScript and Web Site Programming Articles:
✔ How to Create Predefined Google Image Search Links?
Thanks for the Amazon URL [see Creating Amazon Search Links]. That worked beautifully. In fact, I sent you $5.00 for coffee in thanks....
✔ Can I embed a Facebook search box on my blog site?I've seen your articles about how to add a Twitter or Google search box on a Web page, but I have a tougher...
✔ Can I use CSS for drop shadows on my blog?I want to give my site a bit of a facelift and add some neat graphical elements. One of which is drop shadows....
✔ How can I embed interactive photo panoramas on my site/blog?I read through your blog entry about how to take panoramic photos with iOS 6 and an iPhone 5 and got enthused. I've...
✔ How can I create a Twitter search URL shortcut?I'd like to add a few Twitter search links to my Web site. Is that possible, or does Twitter prohibit this sort of...
Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help
right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
Categorized:
HTML, JavaScript and Web Site Programming
(Article 4312,
Written by Dave Taylor)
Tagged: html, searching, site programming, site search Previous: How do I split my Typepad entries into two parts? Next: Can I get Plaxo spam? Reader Comments To Date: 8Dave Taylor said, on December 6, 2007 10:08 AM:
Gary, yes you could: you'd need to stitch them together with some Javascript tied to the "onSubmit" event (you'd add that to the FORM tag). Why do you want to do it that way, though? Hennie Henrico said, on March 14, 2009 6:53 AM:
Hi Dave. Ive copied and pasted this into my html but when I do a google search from there, i google page that says the page was not found or the results where not found. any advise ? Hennie Henrico said, on March 14, 2009 6:59 AM:
Ok, some more info on my previous question. When I type anything into the google search bar on my web page, a google page opens up with the following message: The page - www.google.com/?q=protea - does not exist. When I then click the search button on that page, I get the results I wanted. Have I done something wrong ? is it because i am running html in stead of xhtml ? these tings are so confusing for a first timer like me. keef said, on May 15, 2009 2:59 PM:
Hi Dave, Let's say, set out like this (X = checkbox): KEYWORDINPUTBOX SEARCHBUTTON X my site SUBHEADING 1 SUBHEADING 2 ... and so on. Cheers, keef said, on May 15, 2009 3:06 PM:
... oh, by the way. Cheers, Amy said, on February 26, 2010 12:37 PM:
Dave, M Yakub said, on June 15, 2010 2:16 AM:
Hello and greetings,
I do have a comment, now that you mention it!Check This Out Too... |
Recent Entries
Look for Answers
Recommended
All Our Categories
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and Blogging Building Web Site Traffic Business and Management Computer and Internet Basics d) None of the Above Facebook Help Google Gmail Help Google Plus Help HTML, JavaScript and Web Site Programming Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Kindle Fire Help Mac OS X Help Pay Per Click (PPC) Advertising Pinterest Help Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help Find Me on Google+ ADT on G+ |
Hi
Great Post!
Is there any way I can get two text boxes as input or 2 drop downs as input and then search the site using the concatenation of the two inputs?