Mega Code Archive

 
Categories / JavaScript Tutorial / Window
 

Window prompt()

Syntax window.prompt(string1, string2) The prompt() method of the Window object displays a prompt dialog box when invoked. The string1 is displayed in the box. The string2 is contained in the text field of the prompt dialog box. The returned value of this method is the text in the text field. <html>     <script language="JavaScript">     <!--     while(prompt('Please enter your password', 'HERE') != 'admin'){       alert('That was an incorrect response, please try again');     }     document.write('You have entered the correct password!');     -->     </script> </html>