JavaScript Reference/Javascript Methods/prompt

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

"prompt()" Example

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

"prompt()" is applied to

| Applied_To     |window                                                        |

"prompt()" Syntax, Parameters and Note

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