
How do I add an Ask.Com seach box to my Web site?What is the HTML needed to add an ASK.COM search box or search form to my web page? Thanks. Apparently one great benefit of learning the arcane hypertext markup language (HTML) is that I can crack open Web pages, figure out how the scripts on those pages work and rewrite them to appear on other Web pages or web sites. It's actually kind of a fun little puzzle, but I wouldn't admit that in public lest it make me sound like a bit of a geek. :-) Anyway, the first step is to bring up a page with the search box you want. In the case of Ask.com I suggest that you start with the search box at the top of a search results page, since it's simpler code than their fancy home page. When I searched for actor Johnny Depp, it looks like this: ![]() The source code is accessible by choosing View --> Page Source in Firefox or similar in whatever browser you use. The source is a jumble of complex codes and scripts, as is common on modern sites, but underneath all of that is the core functionality of the search box. When you dig through it, however, you find that the way that they've implemented the search suggestions script means that you can't just extract the form HTML elements and have a functional script. Too bad. Instead, we'll have to reverse engineer the URL that's produced on a search. The page that I show above, for example, has the complicated URL: http://www.ask.com/web?q=johnny+depp&search=search&qsrc=0&o=0&l=dir
Unwrapped this means that we have a bunch of variable=value pairs:
This gives us the following URL: http://www.ask.com/web?q=johnny+depp. Click on it and see what happens. It works! Nice. This means that the Ask.com search box is incredibly simple: <form method="get" action="http://www.ask.com/web" />
<input type="text" name="q" /> <input type="submit" value="search ask.com" /> </form> Easy enough! Now that you have the most basic search box you can jazz it up with some Cascading Style Sheet (CSS) code if you'd like, to make it a bit more fun: <form method="get" action="http://www.ask.com/web"
style="border:3px dotted #C33;padding:6px;background-color:#FEE;" /> <input type="text" name="q" /> <input type="submit" value="search ask.com" /> </form> Which looks like this: Try it if you'd like. It works!
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon
Categorized:
CGI Scripts and Web Site Programming
(Article 8736)
Tagged: ask.com, cgi, css, html, reverse engineering, search engines Previous: How to delete your comments from a YouTube video? Next: How do I organize a meetup? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. delete ask.com from my facepage Posted by: david carder at October 16, 2009 4:25 PMI want part time online form fill up jobs at home. Thank you. Posted by: Saju Dey at October 21, 2009 10:52 AMI have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
![]() ![]()
Search
Find just the answers you seek from among our 2300+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Industry News and Trade Shows Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Book Links
|