...

View Full Version : JavaScript search - help



cnilsson
08-25-2011, 08:11 AM
I have a javascript that allows me to search text on a page.

What I want to do is to limit the search area and not search the entire page.

Can anyone help me with this?

Here is an example page:

http://merchantcertified.com/search.htm

Old Pedant
08-25-2011, 09:02 PM
Easy.

Put <div>...</div> tags around the part you want to search and then only search within that <div>.

But that code you are using is *ANCIENT*.



var NS4 = (document.layers);
var IE4 = (document.all);

Really??? You think *ANYBODY* is still using either MSIE 4 (1999) or Netscape 4 (1998)????

No way.

And that code doesn't work at all in Firefox. Or Chrome. So you have just limited yourself to about 40% of all browsers (that is, MSIE only...and maybe not even MSIE 9).

WAY WAY WAY past time to chuck that code and use something *modern*.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum