Find Dialog: window.find()

Question: How do I invoke the browser's Find dialog from JavaScript?

Answer: In Netscape Navigator, Firefox and some other browsers (but not in Internet Explorer!) you can call the window.find() method without parameters to invoke the browser's Find dialog. Try it now:

This example was created using the following code:
<form>
<input type=button value="Find (Netscape/Firefox/etc)"
onClick="if (window.find) window.find();
else alert('Your browser does not support \'window.find()\'!')
">
</form>
Internet Explorer does not support window.find(). However, in most modern browsers including Internet Explorer, you can write a script that finds a user-defined string on the page. For more information on this technique, see Searching for text.

See also other JavaScript dialogs:

  • Alert (message box) dialog
  • Confirm dialog
  • Promptdialog
  • Print dialog
  • Add Favorite dialog

    Copyright © 1999-2009, JavaScripter.net.