当前位置: 首页 > 网络学院 > 客户端脚本教程 > JavaScript > JS Popup Boxes

JavaScript
JS 字符串
JS Date
JS数组,JS Array
JS Boolean
JS Math
JS HTML DOM
JS Browser
JS Cookies
JS 校验
JS Animation
JS Image Maps
JS Timing
JS 建立对象
JS 摘要
JS 实例
JS 对象实例
JS DOM 实例
JS数组对象参考
JS布尔对象参考
JS日期对象参考

JavaScript 中的 JS Popup Boxes


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1323 ::
收藏到网摘: n/a

In JavaScript we can create three kinds of popup boxes: Alert box, Confirm box, and Prompt box.
在JS里我们可以建立三种不同样子的popup boxes弹出框:警示框,确认框,信息框


Examples
例子

Alert box[警示框]

Alert box with line breaks[换行的警告框]

Confirm box[确认框]

Prompt box[信息框(可输入参数)]


Alert Box
警示框

An alert box is often used if you want to make sure information comes through to the user.
如果你想保证让用户得到信息就使用警示框

When an alert box pops up, the user will have to click "OK" to proceed.
当警示框弹出,用户必须按“OK”来继续

Syntax:
语法:

alert("sometext")

 


Confirm Box
确认框

A confirm box is often used if you want the user to verify or accept something.
确认框用来让用户核实或是接受一些信息。

When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed.
当信息框弹出,用户必须按“OK”或者“Cancel”来继续

If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false.
如果用户按"OK"就返回真,按"取消"就返回假

Syntax:
语法:

confirm("sometext")

 


Prompt Box
信息框

A prompt box is often used if you want the user to input a value before entering a page.
信息框用来让用户在进入页面前输入值。

When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value.
当信息框弹出,用户将在输入值后按“OK”或“Canel”来继续(下面的操作)

If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null.
按“OK”就会返回输入的值,按“取消”就会返回空值

Syntax:
语法:

prompt("sometext","defaultvalue")

评论 (1) 1 All

登陆 | 还没注册?