How to create a semantic search box and engines?

How to create javascript search box?

  • i want to be search able to find addition word at the script.

  • Answer:

    type or paste on notepad editor or ohter source editor. <head> <script type="text/javascript"><!-- var key = ""; function makeEntry (){ this.Name=""; this.URL = ""; this.Desc = ""; this.Category = ""; return this; } function makeArray(n) { this.length = n; for (var k = 1; k <= n; k++) { this[k] = ""; } return this; } function makeLinks(size) { this.length = size; for (var r=1; r<= size; r++) { this[r] = new makeEntry(); this[r].Name = namesArray[r]; this[r].URL = urlsArray[r]; this[r].Desc = descArray[r]; } return this; } var linksize=0 datesArray = new makeArray(linksize); namesArray = new makeArray(linksize); urlsArray = new makeArray(linksize); descArray = new makeArray(linksize); var arraycount=0 arraycount += 1 urlsArray[arraycount] = "http://PAGE URL" namesArray[arraycount] = "PAGE DESCRIPTION" descArray[arraycount] = "SEARCH WORDS" arraycount += 1 urlsArray[arraycount] = "http://PAGE URL" namesArray[arraycount] = "PAGE DESCRIPTION" descArray[arraycount] = "SEARCH WORDS" linksize = arraycount; // ----end data ------- function searchLinks(links, keyword){ document.write("<body bgcolor='#e0ffff' text='#8b0000' link='#000066' vlink='#000066' alink='#00ced1'>") document.write("Search results for keyword: <strong>" +keyword +"</strong><br><br>"); for (var q=1; q<=links.length; q++) { if (links[q].URL.toLowerCase().indexOf(keyw… != -1){ document.write("<a href=" + links[q].URL +">" + links[q].Name + "</a> - "); document.write( links[q].Desc + "<br>"); continue; } if (links[q].Desc.toLowerCase().indexOf(key… != -1) { document.write("<a href=" + links[q].URL +">" + links[q].Name + "</a> - "); document.write( links[q].Desc + "<br>"); continue; } if (links[q].Name.toLowerCase().indexOf(key… != -1) { document.write("<a href=" + links[q].URL +">" + links[q].Name + "</a> - "); document.write( links[q].Desc + "<br>"); continue; } } } //--></script> <P ALIGN="CENTER"><form name="form"> Type in a word or phrase you are searching for:<br><input type="text" size=50 name="search"><br> <input type="button" name="submit" value="Find It" onClick="validate_form()">  <input type="reset" name="reset" value="Clear"></form></P> <script type="text/javascript"><!-- function validate_form() { txt = document.form.search.value; if (txt.indexOf(".") != -1){ alert("Search is invalid! Contains a '.'"); return;} if (txt.indexOf(",") != -1){ alert("Search is invalid! Contains a ','"); return;} if (txt.indexOf("@") != -1){ alert("Search is invalid! Contains a '@''"); return;} if (txt.indexOf("!") != -1){ alert("Search is invalid! Contains a '!''"); return;} if (txt.indexOf("#") != -1){ alert("Search is invalid! Contains a '#''"); return;} if (txt.indexOf("$") != -1){ alert("Search is invalid! Contains a '$''"); return;} if (txt.indexOf("%") != -1){ alert("Search is invalid! Contains a '%''"); return;} if (txt.indexOf("*") != -1){ alert("Search is invalid! Contains a '*''"); return;} if (txt.indexOf("(") != -1){ alert("Search is invalid! Contains a '(''"); return;} if (txt.indexOf(")") != -1){ alert("Search is invalid! Contains a ')''"); return;} if (txt.indexOf("[") != -1){ alert("Search is invalid! Contains a '[''"); return;} if (txt.indexOf("]") != -1){ alert("Search is invalid! Contains a ']''"); return;} if (txt.indexOf(";") != -1){ alert("Search is invalid! Contains a ';''"); return;} if (txt.indexOf(":") != -1){ alert("Search is invalid! Contains a ':''"); return;} else { jsi = new makeLinks(linksize); searchLinks(jsi, txt); document.write("<br><hr><br>"); document.write("<a href='http://jdstiles.com/java/search.ht… to Search Page</a><br>"); } } </script> </head>

Shipra at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.