The javascript dialog box for the tutorial "(www.bkjia.com)" has the following forms:
1. alert ()
2. confirm ()
3. directly call window. event. returnValue to bring up the dialog box.
4. prompt ()
I. alert
In the alert dialog box, only one confirm button is used. For example:
Usage:
Reference content is as follows: Function funShowAlert () { Alert ("only OK! "); } |
Ii. confirm
The confirm dialog box contains the "OK" and "cancel" buttons. For example:
Usage:
Reference content is as follows: Function funShowConfirm () { If (window. confirm ("confirm dialog box ")) { Alert ("You selected OK "); } Else { Alert ("you have chosen to cancel "); } } |
3. directly call the window. event. returnValue pop-up dialog box. The dialog box also contains the "OK" and "cancel" buttons, but the icons in the dialog box are exclamation points, such:
For example, when we close the page, the close page dialog box is displayed. The Code is as follows:
Reference content is as follows: <Body onbeforeunload = "window. event. returnValue = 'Dialog box with exclamation marks- (www.bkjia.com) '"> </body> |
4. prompt is a dialog box with an input box. It is not described here.