笔记(2): alert( ) , confirm( ), and prompt( )
alert( ) displays a message to the user.
返回值: undefined,也就是没有返回值.
confirm( ) asks the user to click an Ok or Cancel button to confirm or cancel an operation.
返回值: true,用户选择"OK"; false,用户选择"Cancel".
prompt( ) asks the user to enter a string.
返回值: 用户输入值.
注意:
confirm( ) and prompt( ) methods block -- that is, those methods do not return until the user dismisses the dialog boxes they display.
alert( ) method also blocks and waits for the user to dismiss the dialog box. In some browsers, however (notably Netscape 3 and 4 on Unix platforms), alert( ) does not block.
3个对话框的例子如下: