home *** CD-ROM | disk | FTP | other *** search
- ******************************************************************************
- Please remove this section from the actual page when
- you actually use this page.
-
- Here are the thing you need to modify in the page
-
- 1.title[0]=no_of_urls
- ( this is for the total number of urls which will be searched )
-
- 2. fill in the the details
-
- title[1]="fill in the list of keywords here"
- desc[1]="fill in the description of the url here "
- links[1]="http://yoursite.com/yourpage.html"
-
- (rememeber all of these should be encapsulated in the quotes)
- (all the keywords should be seperated by blanks and should be in lowercase)
-
- 3. You can also change the heading of results
- Replace 'Search Results' by 'your_title'
-
- Copyright for all the HTMLSearch code rests with with Satadip Dutta
- *****************************************************************************
-
- <html>
- <title>
- Search Engine
- </title>
- <head>
- <script>
-
- <!-- Begin copyright - This must be retained and posted as is to use this script -->
-
- <!--// This Script was created by Satadip Dutta.
- // Email: sat_dutta@post1.com / satadipd@inf.com
- // URL:http://dutta.home.ml.org
- // Version 1.1-Netscp
- // Please honor my hard work, if you use a variant of this in your page,
- // then please email me :) and keep these comments in the Script.
- // This code is Copyright (c) 1997 Satadip Dutta
- // all rights reserved.
- // License is granted to user to reuse this code on their own Web site
- // if, and only if, this entire copyright notice is included. The Web Site
- // containing this script must be a not-for-profit ( non-commercial ) web site.
- // Exclusive written permission must be obtained before using this version of the search engine
- //-->
- <!-- End copyright - This must be retained and posted as is to use this script -->
-
- title = new Object();
- desc = new Object();
- links= new Object();
- matched= new Object();
- keywords= new Object();
- found= new Object();
- var temp=0;
- // actual location or the item to be searched // description of he location
- // actual link
- // percentage match found
- // keywords as parsed from the input
- // # of titles present in the database
- title[0]=10
- //no of keywords after parsing
- keywords[0]=0
- //no of matches found.
- found[0]=0
-
- <!-- Begin List of Searchable Items -->
-
- <!--put the list of the links and descriptions here!!-->
-
- title[1]="homepage dutta"
- desc[1]="Inch of Dutta's Life"
- links[1]="http://dutta.home.ml.org"
- matched[1]=0
-
- title[2]="yahoo search engine"
- desc[2]=" the yahoo search engine "
- links[2]=" http://www.yahoo.com"
- matched[2]=0
-
- title[3]=" lycos search engine"
- desc[3]="The lycos search engine "
- links[3]=" http://www.lycos.com"
- matched[3]=0
-
- title[4]=" infoseek search Engine"
- desc[4]="The Infoseek Search Engine "
- links[4]=" http://www.infoseek.com"
- matched[4]=0
-
-
- title[5]="learn html "
- desc[5]="Htmlgoodies.com-learn your HTML here"
- links[5]="http://www.htmlgoodies.com"
- matched[5]=0
-
- title[6]="java scripts submit html goodies color text scrolling text display javascript"
- desc[6]="Java Goodies - Striving to be the largest collection of Java Scripts on the World Wide Web"
- links[6]="http://www.htmlgoodies.com/javagoodies/"
- matched[6]=0
-
-
-
- title[7]="free homepages"
- desc[7]="Geocities.com"
- links[7]="http://www.geocities.com"
- matched[7]=0
-
-
- title[8]="free homepages"
- desc[8]="Angelfire.com"
- links[8]="http://www.angelfire.com"
- matched[8]=0
-
-
- title[9]="free email"
- desc[9]="hotmail.com"
- links[9]="http://www.hotmail.com"
- matched[9]=0
-
-
- title[10]="free email"
- desc[10]="rocketmail.com"
- links[10]="http://www.rocketmail.com"
- matched[10]=0
-
- <!-- End list of Searchable items -->
-
- function search(){
- // get the input from the input by the user and strip it into keywords //
- var skeyword=document.searchengine.keywords.value.toLowerCase();
-
- var check=1;
- var pos=0;
- var i=0;
- var j=0;
- var itemp=0;
- var config='';
-
- while (true)
- {
- if (skeyword.indexOf("+") == -1 )
- {
- keywords[check]=skeyword;
-
- break;
- }
- pos=skeyword.indexOf("+");
- if (skeyword !="+")
- {
- keywords[check]=skeyword.substring(0,pos); check++;
- }
- else
- {
- check--;
- break;
- }
- skeyword=skeyword.substring(pos+1, skeyword.length);
- if (skeyword.length ==0)
- {
- check--;
- break;
- }
-
- }
- // the keywords have been put in keywords object.
- keywords[0]=check;
- //alert(check);
- // matching and storing the matches in matched
- for ( i=1; i<=keywords[0];i++)
-
- {
- for (j=1;j<=title[0];j++)
-
- {
- if (title[j].toLowerCase().indexOf(keywords[i]) > -1 )
- {
- matched[j]++;
- }
- }
- }
- // putting all the indexes of the matched records in found
-
- for (i=1;i<=title[0];i++)
-
- {
- if (matched[i] > 0 )
- {
- found[0]++;
- // increment the found
- found[found[0]]=i;
-
- }
- }
- //alert("found 0 " + found[0]);
- // sort the list as per max percentage of matches
-
-
- for (i=1;i<=found[0]-1;i++)
-
- {
- for(j=i+1;j<=found[0];j++)
-
- {
- if ( matched[found[i]]< matched[found[j]] )
- {
- temp= found[j];
-
- found[j]=found[i];
-
- found[i]=temp;
-
- }
- }
- }
-
-
-
-
-
-
- config='toolbar=no,location=no,directories=no,status=no,menubar=no,'
- config += 'scrollbars=yes,resizable=yes'
- output = window.open ("","outputwindow",config)
- output.document.write('<title> Daves Search Results </title>');
- output.document.write('<BODY bgcolor=#ffffff text=#000000 link=#990099 vlink =#339966 >');
-
- output.document.write('<center> <h1> Search Results </h1></center>');
- output.document.write('<hr>');
- output.document.write(' The Keyword(s) you searched :: '.big() );
- for (i=1; i<=keywords[0]; i++)
- {
- output.document.write( keywords[i].bold() +" "); }
- output.document.write('<br>');
-
- if (found[0]==0)
- {
-
- output.document.write('<hr>');
- output.document.write("<b>No matches resulted in this search </b> <br>");
- output.document.write("You may close the results and reduce the length/number of the keywords <br>");
- }
- else
- {
-
- output.document.write(" <hr> <b> The Results of the search are : </b> ");
- output.document.write( found[0] +" Entries found ".italics());
- output.document.write("<table border=1 width=100%>");
- for (i=1; i<=found[0];i++)
-
- {
- output.document.write("<tr><td valign=topbgcolor=#9999ff>");
- output.document.write("<h3>" +i +"</h3>"); output.document.write("<td valign=top>");
- itemp=found[i];
- output.document.write(desc[itemp].bold() +"<br>" +links[itemp].link(links[itemp])+"<br>");
- temp= (matched[itemp]/keywords[0])*100
- output.document.write("<i> Matched with keywords :: "+temp+" % </i>" );
- matched[itemp]=0
- }
- found[0]=0;
- output.document.write("</table>");
- }
- output.document.write ('This search was created by © <a href="http:\\dutta.home.ml.org"> Satadip Dutta</a> 1997'); output.document.write ("<hr>");
- output.document.write ("<form><center>");
- output.document.write ("<input type='button' value='Start Another Search' onClick = 'self.close()'>") ;
- output.document.write ("</center></form>");
- output.document.close();
- }
- </script>
- <head>
- <body>
-
- <center>
- <H1>Search Engine</H1>
- </center>
- <hr>
- This is a search engine implemented in Javascript. You will need a
- Java Script enabled browser to run this search.
- <hr>
- <P>
- </P>
-
- <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=5>
- <TR>
- <TD WIDTH="20%" ALIGN="left">
- This search is NOT case sensitive.
- </TD>
- <TD WIDTH="80%" ALIGN="left">
- Put "+" between keywords in a list if using more than one keywords.
- </TD>
- </TR>
- </TABLE>
- <form name="searchengine">
-
- <center>
- Keywords:
- <input type = text name ="keywords" value="" maxlength=40>
- <input type = button name="go" Value="Go ahead and find" onClick="search()">
- <br>
- </center>
- </form>
- <hr>
- This search script was created by © <a href="http://dutta.home.ml.org">Satadip Dutta</a> 1997
- <!-- you can write more text/instructions out here. -->
- </body>
- <html>
-