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!