This example is, as you can see, working in Mozilla, NS4 & IE4+
Code:
<html>
<head>
<script language="javascript">
function search(text)
{
if(!text) return false;
var ua = navigator.userAgent;
if(/Mozilla\/5\.0/.test(ua) && !/Netscape/.test(ua) || /Mozilla\/4/.test(ua) && !/MSIE/.test(ua))
{
find(text);
}
else if(/Mozilla\/4/.test(ua) && /MSIE/.test(ua))
{
var body = document.body.createTextRange();
if(body.findText(text)) body.select();
}
}
</script>
</head>
<body onload="search(prompt('Text to search for?', 'document'));">
<p>Some text in the body of the document.</p>
</body>
</html>
Bookmarks