Home

Keebler/Blog

« Kari Byron on MythBusters
Browser Built-in Editing Platforms »

Javascript In-Page Search Engine

I needed a search engine implemented really fast at work today so I whipped up this little Javascript search engine. All it does is iterate through the HTML DOM of a list (document.getElementById(…)), looking for list-items (.getElementsByTagName("li")) that match a regular expression. It then displays (.style.display="block") those items, while hiding the rest (.style.display="none"). A similar technique could be used to search entire pages (.getElementsByTagName("*")).

The technique runs pretty quick for running through 2000+ items, but it does hit the processor pretty hard.  Also, I’ve still got to figure out how to capture the "Enter key" event in Mozilla browsers…Sorrrry, let’s see how fast you can write a search engine! :D

CityTV | TV SHOWS | CityCooks

Related Posts

  • The MTV.ca home page is now 6.25MB in size!
  • Twitter Search API is using th…

This entry was posted on Tuesday, August 23rd, 2005 at 7:01 pm and is filed under Web Development. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.

  • Blog Home

  • Tags

    90210 alessandra ambrosio animals asp.net audrina patridge battlestar galactica bikini bunny bush C# canada canada election ctv ctvglobemedia development Election Entertainment/Celebrity facebook Gordon Ramsay gorilla gossip girl hayden panettiere iphone last.fm liveblog liveblogging mesh08 muchmusic Music obama palin rachel bilson scribblelive shenae grimes subway telemarketers the hills the killers the office toronto ttc toronto tv us election video yeah yeah yeahs

    WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

  • Recent Posts

    • Got tickets for USA vs. Switze…
    • On my way to YYZ to fly to the…
    • RT @scribblelive: Financial Po…
    • In Olympic Skelton, Canadian M…
    • Hoping people keep putting pre…
  • Categories

    • Election
    • Entertainment/Celebrity
    • Fake News
    • Featured
    • Funny
    • Keebler/Show
    • Music
    • My Releases
    • On-the-Road
    • RedDot
    • Reviews
    • Science/Technology
    • ScribbleLive
    • Security
    • Software
    • Torrent Live Stats
    • Tweets
    • Uncategorized
    • Web Development
  • Blogroll

    • Kitten-Monkey’s Cell
    • :: kattekylling ::
    • Adam Finley
    • blog-j
    • fuzzz.gaulin.ca
    • Idiot Banter
    • mad.greyarea.com
    • ob.blog
    • PollyPrissyPants
    • RedDot CMS Users Google Group
    • ScribbleLive Official Blog
  • My Sites

    • Flickr2Facebook
    • RedDot CMS
    • ScribbleLive
    • Where are my f(acebook)ing friends?
    • WhyYouShould