You knew that it would only be a matter of time before some one would take our favorite scripting language, JavaScript, and try to build one of the most complex creations in computer science, a search engine. Andrew Taylor was browsing a certain company's website and noticed that their search function was wholly useless, but seemed to return results incredibly quickly, without even reshing the page. Curious as to what this might be, Andrew did a quick View Source and uncovered the JavaScript Search Engine ...

searchItems = new Array();

searchItems[0] = new Array
 ( "Initech Solutions :: Home",
   "The home page for Initech Solutions.",
   new Array (

searchItems[1] = new Array
 ( "Initech Solutions :: Contact Sales",
   "For any questions regarding our products and services,"
   + " please use this form to contact our sales staff.",
   new Array (

/* Snipped search conditions */

searchItems[46] = new Array
 ( "Products :: TPS Manager",
   "If you have been overwhelemed by TPS requirements,"
   + " you may find TPS Manager a nice addition to your "
   + " product suite.",
   new Array (

searchItems[47] = new Array
 ( "Services :: NMP Compliance",
   "With ever changing NMP regulations, it's vital to"
   + " keep up to date with guidelines. Click here to"
   + " find out how.",
   new Array (

function SiteSearch(srch)

  words = srch.split(" ");
  results = new Array();

  for (i=0; i<searchItems.length; i++)
  for (j=0; j<searchItems[i][3].length; j++)
  for (k=0; k<words.length; k++)
    if (searchItems[i][3][j] == words[k].toLowerCase())
      results[results.length] = 
        new Array
          ( searchItems[i][0], 

  resultText = "";
  if (!results.length)
    resultText = "No results found. Please try different key words.";

    for (i=0; i<results.length; i++)
      resultText = 
        "<a href='/" + results[i][1] + "'>" + results[i][0] + "</a>"
        + "<br>"
        + results[i][2]
        + "<br><br>";

  document.getElementById("searchResults").innerHTML = resultText;

  alert("Search Complete.");

(Note that all identifying information has been changed to protect the innocent/guilty)

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!