groups

name language licence
mailto with subject HTML Other
JavaScript Compressor - HTML HTML GPL 2
RapidWeaver Media Albums with prettyPhoto JavaScript Other
jQuery boiler plate JavaScript Other
sikbox Live Search JavaScript Other
jsPathto.min.js JavaScript Other
SearchInWindow JavaScript Other
JavaScript Compressor - JavaScript JavaScript GPL 2

< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 >



language: JavaScript
licence: Other

SearchInWindow

options: view full snippetsend to code collector
/*
Question: How do I search for a particular text string on the page?

Answer: In several browsers (Netscape Navigator, Firefox, Google Chrome), to search for a string programmatically, you can use the window.find(string) method; see also Find Dialog. Internet Explorer does not support this method. However, in Internet Explorer 4.x and newer, you can create a text range object (TRange in the example below) and use the method TRange.findText(string).

Example: The following script gets a text string from the user and then finds and highlights this string on the page. 
 
This example has been created using the following code:
*/

var TRange=null

function findString (str) {
 if (parseInt(navigator.appVersion)<4) return;
 var strFound;
	
(Continues...)