Application Features | JavaScript Techniques |
---|---|
• Frames-Based Multiple Search Engine | • Reusing Your Code |
• Single-Click Searching | • Foregoing OO |
• Simple Search Engine Management | • Math Versus Memory |
 | • Using escape() |
Multiple search engine apps written in JavaScript abound on the Net.
This kind of application is one of the coolest and potentially
easiest things to develop in JavaScript. And why not? You can
capitalize on OPD (other peopleâs data) to make your web site a
portal to the network universe. This is my version. There are
certainly more robust applications out there, but this one gives you
significant advantages fairly easily. Figure 4.1
shows the first look as you open
ch04/index.html
in your
browser.
Using this application isnât complicated. The user enters query text in the bottom left corner, then uses the arrows to advance through a layer-based menu of available search engines. All the user needs to do is click on the button of the search engine he or she wants to send the query text to, and the results show up in the center frame. I searched the Image Surfer database for the term âandromedaâ and received the results shown in Figure 4.2.
Figure 4-2. Image Surfer returns pictures in its database associated with the term âandromedaâ
Thatâs really all there is to it. Notice the search results frame is surrounded by a black border. Thatâs my award-winning attempt at web page design. Itâs a personal preference and easy to change to a more basic two-frame (top and bottom) layout.
By the way, if youâve been following the chapters in order, youâll soon notice that this one is different in that it doesnât present entirely new code. Actually, Iâll show you how to get extra mileage out of the code we covered in Chapter 3. This will be a great way to see how you can reapply code that you already have to save time.
This application uses DHTML, so youâll need NN or MSIE 4.x to use it. I included 20 search engines. The number of search engines you use can easily reach the hundreds. But thatâs probably more than the average user will ever need. Keep in mind, too, that this application might run really well on your local machine, but, as with the slideshow, lots of graphics will increase the load time for Internet users.
Get JavaScript Application Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.