Click here to Skip to main content
14,355,411 members

Searchlite v2

Rate this:
3.91 (6 votes)
Please Sign up or sign in to vote.
3.91 (6 votes)
4 Jul 2002
Search multiple sites at once and view results on a single page


After taking a look at SearchLite , the Javascript program I wrote to search multiple search-engines at once, a friend complained about all the new windows that opened for each site. He wished he could get all the results from multiple sites on a single page. We got thinking and I implemented this solution using IFRAME .

The wonderful thing about IFRAME is that its supported both by IE and Netscape 6. It is good for developers that finally both IE and Netscape are complying with W3C standards.

Although Netscape introduced several pioneering browser features, in recent times, it has not been able to catch up with IE and it has long been the butt of jokes. Netscape 6, based on Gecko, is a major upgrade over version 4 and sports a new look now. Gecko is the rendering engine of the Mozilla open source project. Gecko is embeddable, free, and open source. Bugzilla is the bug-tracking system used by the Mozilla project.


The IFRAME element allows HTML content from one document to be loaded within the body of another document.

The following are some of the properties common to Netscape 6 and IE -
  • ID - Retrieves the string identifying the object.
  • FRAMEBORDER - Sets or retrieves whether to display a border for the frame. Possible Values are 1/yes/0/no.
  • SCROLLING - Sets or retrieves whether the frame can be scrolled. Possible Values are yes/no.
  • SRC - Sets or retrieves a URL to be loaded within the inline frame
  • WIDTH,HEIGHT - Sets or retrieves the width and height.

The LAYER tag is no longer supported in Netscape 6. More exhaustive information about IFRAME can be found here

The Source

For understandability and just in case you haven't taken a peek at SearchLite, let me just re-hash the way the script works. Information can be posted using a HTML Form through the GET or POST method. If a site uses the GET method, the values that are submitted by the user are visible in the URL. 

Taking advantage of this particular QueryString feature we can dynamically build a URL based on the Site and the Keyword specified. For instance by placing a keyword at the end of this URL ,  I can search on Google without having to actually visit their homepage. HTML cannot handle certain special characters and so care must be taken to escape them so that the URL is a valid one and the parameters are properly received. 

Javascript has a function called escape() which does the job. The escape function encodes special characters in the specified string and returns the new string. It encodes spaces, punctuation, and any other character that is not an ASCII alphanumeric character, with the exception of these characters: * @ - _ + . /

By noticing the URL of other Search engines this script can be customized to handle any other sites which use the GET method to accept search keywords. SearchLite v2 uses IFRAMEs to show results of multiple sites on a single page. Initially all the IFRAME elements are hidden using CSS (the good news is Netscape 6 fully supports the CSS1 standard) in the BODY onLoad event.

function hide() 
    for (var icnt=1;icnt<13;icnt++)
        document.getElementById("f"+icnt).style.visibility = 'hidden';
        document.getElementById("t"+icnt).style.visibility = 'hidden';
<body onload="hide()">

Depending on how many checkboxes corresponding to the sites to be searched are clicked, an equivalent number of IFRAME elements are made visible. Only as many IFRAME elements as needed are shown. The URL that is dynamically created based on the keyword specified is set to the SRC property of

.The function below is activated on-clicking the FIND button

function win()
frmlen = document.myform.elements.length;
    for (var icnt=0;icnt<frmlen;icnt++)
        //loop thru all FORM elements and look for checkboxes 
        //which have been checked
        if (document.myform.elements[icnt].type=="checkbox" && 
            //make IFRAME visible
            document.getElementById("f"+idiv).style.visibility = 'visible';

            //make textbox that shows heading with 
            //name of site being searched, visible
            document.getElementById("t"+idiv).style.visibility = 'visible';

            //build the URL
            strSite = document.myform.elements[icnt].value;
            strSearch= escape(document.myform.mytext.value);
            url = strSite + strSearch;

            //set SRC property of IFRAME to dynamically built URL
            document.getElementById("f"+idiv).src = url;

            //show only the domain name part of the URL

            document.getElementById("t"+idiv).value = 


To distinguish each result frame, the title is shown inside a text box, camouflaged as a heading using CSS

HEIGHT: 22px; WIDTH: 599px;
<input type='text' id='t1' class='txt'>

After you unzip the source file, run it in IE or Netscape 6....and do let me know what you felt about it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

'Anil' Radhakrishna
Web Developer
India India
'Anil' Radhakrishna is a seasoned developer who enjoys working with Microsoft tools & technologies. He blogs quite regularly about his little discoveries and technical experiments on his blog called Tech Tips, Tricks & Trivia. He loves building mash-ups using public Web APIs.

Comments and Discussions

GeneralPretty nifty Pin
benjymous24-May-02 7:07
memberbenjymous24-May-02 7:07 
GeneralRe: Pretty nifty Pin
'Anil' Radhakrishna25-May-02 3:01
member'Anil' Radhakrishna25-May-02 3:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 17 May 2002


13 bookmarked