Does anyone know how to launch the windows find utility from an HTML command button. I just don't want the user to have to press ctrl + F everytime they want to seearch for something on a web page..
You can probably automate the pop-up of the find window in IE, but I am not sure exactly how to do that. You could also use this find function.
<SCRIPT LANGUAGE="JavaScript">
var NS4 = (document.layers);
var IE4 = (document.all);
var win = this;
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == ""
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0) alert(str + " was not found on this page."
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit"
}
if (found) {
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert(str + " was not found on this page."
}
}
return false;
}
// End -->
</script>
------------------------------------------
Put this in the body
<form name=search onSubmit="return findInPage(this.string.value);">
<b><font face = "Arial, Helvetica, sans-serif">Find on Page</b></font>
<input name=string type=text size=15 onChange="n = 0;">
</form>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.