JavaScript Reference/Javascript Methods/prompt

Материал из Web эксперт
Перейти к: навигация, поиск

"prompt()" Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
    window.prompt("Please, enter your full name", "Yes, here"); 
} 
</script>
<input type="button" value="Open a prompt window" onclick="function1();">
</body>
</html>



"prompt()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |window                                                        |
+----------------+--------------------------------------------------------------+



"prompt()" Syntax, Parameters and Note

Note:
Opens a prompt window. 
Returns the string typed in by the user.
    
Syntax:
    
window.prompt(param1, param2)
Parameters:
    param1   Optional; the message to display in the prompt window.
    param2   Optional; a default value for the input field.