I got following script, but it only works in IE, I'd like it to support other browsers as well (Chrome, Firefox), but have no idea how to do it. Script is for search in page Complete script is here: http://goo.gl/aEk3r - Google Docs
function performMultiSearch(elem,searchElem) {
// set up variables
var searchString; // Will hold the text to search for
var theSelection; // Will hold the document's selection object
var textNodes; // Will hold all the text nodes in the document
// Set it to search the entire document if we haven't been given an element to search
if(!searchElem || typeof(searchElem) == 'undefined') searchElem = document.body;
// Get the string to search for
if(elem && elem.value) searchString = elem.value;
else if(this && this.value) searchString = this.value;
// Get all the text nodes in the document
textNodes = findTypeNodes(searchElem,3);
// Get the selection object
if(window.getSelection) theSelection = window.getSelection(); // firefox
else { // some other browser - doesn't support multiple selections at once
alert("sorry this searching method isn't supported by your browser");
return;
}
// Empty the selection
theSelection.removeAllRanges(); // We want to empty the selection regardless of whether we're selecting anything
thanks a lot