The window.prompt() method allows users to enter text into a single-line text field (see Figure 2.2). This information is the return value of the method call and can be further used in the script. Figure 2.2. The input box generated by window.prompt().Prompting for User Data (prompt.html)
Note Do note that if the Cancel button is clicked or the Esc key is pressed, window.prompt() returns null. The preceding code checks that; if the OK button is pressed, the data entered is shown. |