求alert confirm prompt的详细用法

bluebohe 2004-07-11 08:20:34
我现在的任务需要详细的解析confirm和alert和prompt三个方法,给我的任务中让我解析以下东西,但现在我不知道它们的各个参数是什么涵义
window.confirm with 0, 1, 2, 3 parameters (more parameters are ignored)
window.alert with 0,1 parameters
window.prompt with 0,1,2 parameters

javascript有没有像MSDN一样的支持?
多谢!我做VC方面的,这些东西以前很少接触,希望大家帮忙
...全文
424 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluebohe 2004-07-11
  • 打赏
  • 举报
回复
多谢楼上各位,看来是我的老板糊涂了:)结帖
hoho,我好像还给很多高人发了消息,在这里一并感谢!谢谢你们的关注!
wanghr100 2004-07-11
  • 打赏
  • 举报
回复
window.confirm 参数就只有一个.显示提示框的信息.
按确定,返回true; 按取消返回false.

<script>
var bln = window.confirm("确定吗?");
alert(bln)
</script>


window.alert参数,只有一个,显示警告框的信息;
无返回值.

<script>
window.alert("确定.")
</script>

window.prompt参数,有两个,
第一个参数,显示提示输入框的信息.
第二个参数,用于显示输入框的默认值.
返回,用户输入的值.

<script>
var str = window.prompt("请输入密码","password")
alert(str);
</script>
hbzyduwu 2004-07-11
  • 打赏
  • 举报
回复
因为他不知道呀~. 不过你可以在这个上面扩充
bluebohe 2004-07-11
  • 打赏
  • 举报
回复
object.confirm([message])
仅仅最多一个参数么?真奇怪为什么老板让我写两个和三个参数的东东
hbzyduwu 2004-07-11
  • 打赏
  • 举报
回复
confirm

--------------------------------------------------------------------------------

Description

Displays a Confirm dialog box with the specified message, and OK and Cancel buttons.

Syntax
object.confirm([message])



Parameter Description
message Optional. (String) String to display.

Return Value

Returns TRUE if the user chooses OK, or FALSE if the user chooses Cancel.

Remarks

You have no control over the dialog box title.

Applies To

window



alert

--------------------------------------------------------------------------------

Description

Displays an Alert dialog box with a message and an OK button.

Syntax
object.alert([message])



Parameter Description
message Optional. (String) String to display.

Return Value

No return value.

Remarks

The title bar of the Alert dialog box cannot be changed.

Applies To

window


prompt

--------------------------------------------------------------------------------

Description

Displays a Prompt dialog box with a message and an input field.

Syntax
object.prompt([message [, inputDefault]])



Parameter Description
message Optional. (String) String to display.
inputDefault Optional. (String) String or integer that represents the default value of the input field.

Return Value

Returns the value that the user types in.

Remarks

If the inputDefault parameter is not supplied, the dialog box displays the value <undefined>. You have no control over the title of the prompt box.

Applies To

window


手册上的,希望对你有用~

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧