上一篇 | 下一篇

用VBScript制作定制的alert弹出消息框

发布: 2008-6-27 11:48 | 作者: admin | 来源: | 查看: 1次

Creating customizable alert boxes using

VBScript

No, we're not stabbing JavaScript in the back...just

having a little harmless fun in this tutorial. The entertainment?

Customizable alert boxes.

In JavaScript, alert boxes are as simplistic- and dull- as

they come:

alert("Hello there")

Apart from the message itself, nothing is changeable in terms of the

box's interface. Where JavaScript skims through, VBScript dwells on,

however. Alert boxes called using the later language can be customized in

ways that the former can only dream of.

A basic alert box in VBScript is produced using the following code:

From this point on, however, things take on a life of its own, thanks

to the optional parameters the above method supports. Case in

point:

MsgBox "Hello

there",64,"Greetings From WA"

Note the differing icon image to the left of the message, not to

mention the title on top!

The below tables contain the supported values for the second parameter

of MsgBox, which we'll show first, then explain how to use:

'Which buttons" Table:

Constant

Rendered

button(s)

0

"Ok" button

1

"Ok" AND "Cancel"

buttons

2

"Abort", 'Retry",

AND "Ignore" buttons

3

"Yes", 'No", AND

"Cancel" buttons

4

"Yes" AND "No"

button

5

"Retry" AND "Cancel"

button

字号: | 推荐给好友

31/3123>

评分:0

我来说两句