Search the Page | JavaScriptSource

Search the Page

Robin Winslow Apr 25, 2007


This script will allow your visitors to search a Web page for any matching characters. It can be set for the entire page or within a specific ID attribute. Simple to use and heavily annotated.

Search the page


If you only want to search within a specific ID, just change the third line of code in the addLoadEvent function.

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: searchPage.js


Paste this code into the HEAD section of your HTML document.


Paste this code into the BODY section of your HTML document

Leave a Response


I wanted my visitor to search my site.I have decided to use javascript because my site is small and mostly static. This particular code I am finding o.k. But where to put my site name and what changes should i make so that I can use this script on my site.

Swati Kothari Jun 17, 2013

does not work in Firefox or Chrome

Tom Walsh Feb 7, 2013

You would need a different script. This one is for searching the current page.

Lee Nov 6, 2008

I tried over ten script none worked for me and on Opera browser but your script do the job just excellent, thanks lot.

tunayx Oct 22, 2008

Hi[br /]The code for search is not working.[br /]I want to search some pages of specific words like eductional qualification = Graduate etc. form some other website in[br /]what changes should I make?[br /]Where[br /]Awaiting[br /]Regards[br /]Manish Wagh

Manish Wagh Oct 17, 2008