Prompt caption (only MSIE): Prompt text:

Prompt default input value:

In yet another sly move by Micro$oft, MSIE 7 has been designed to suppress the javascript prompt function, yet at the same time always allow their MSIE-specific showModalDialog method. This has broken millions of web sites. The work-arounds to this problem are any of these:

  1. Use the showModalDialog method instead and thereby only support MSIE browsers (they wish).
  2. Do away with using prompt dialogs completely.
  3. Use simulated modal dialogs with layer's and key capturing (complicated and messy).
  4. Use this class to simulate the javascript prompt function by using showModalDialog for MSIE 7 and up.

Usage:

  1. Place the files Prompt.js, Prompt.html, and Prompt.png together into any directory in your site.
    Do not rename any of the files or else it won't work.
  2. Place this line in the head section of your html:
    <script type="text/javascript" src="/path/to/Prompt.js"></script>
  3. Show the dialog as you would using the javascript prompt function:
       var name  = Prompt.show('Who are you?');
       var sides = Prompt.show("How many sides does a square have?", 4, 'Silly question dialog');
       var count = Prompt.show("How many\nlines\ndo\n\n\nyou see\nhere?", '', 'Answer this');
      

The Prompt.* files