|
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!
Categorized:
CGI Scripts and Web Site Programming
(Article 8736,
Written by Dave Taylor)
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!
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!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and RSS Feeds Building Web Site Traffic Business and Management CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above Facebook Help Google Plus Help HTML and CSS Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Mac OS X Help Pay Per Click (PPC) Advertising 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 WordPress Help |