window.prompt() : Window Object : Window JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Window » Window Object »

 

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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Window
» Window Object