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

JavaScript
JS数学对象参考
JS字符串对象参考
JS函数参考
JS事件参考
Javascript 常用正则表达式
FF和IE下的js兼容性问题
jQuery 简单介绍
jQuery / 核心 / $(expression, [context] ) 函数
jQuery / 核心 / $(html) 函数
如何使用JS来判断浏览器类型(ie、firefox,等等)
Javascript在IE和FireFox中的不同表现
3个js字符编码函数区别
javascript 中的 XMLDOM 对象

JavaScript 中的 JS Popup Boxes


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1279 ::
收藏到网摘: 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

登陆 | 还没注册?