[JavaScript: The Definitive Guide]笔记(2)

笔记(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个对话框的例子如下:

figs/js4_1301.gif

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值