Previous | Home | Next |
There are three important types of dialog boxes used in javascript These all dialog boxes perform different operation .
- Alert dilog box ().
- promot dialog box ().
- confirm dialog box() .
Alert (). An alert dialog box is manely used to give a warning message to the users
alert() is a simple function to display a message
Syntax :
alert("Hii this is r4r");
Example :
<html> <body> <script> alert("This is r4r tutorial"); </script> </body> </html>
Output:
prompt dialog box ()
The prompt dialog box is very important when you want to pop-up a text box from get user input.
This dialog box has two buttons OK and Cancel button. if user press ok button then its login on the page but when user click on cancel button then its cancel the login page .
Syntax :.prompt ("Enter text " ," Enter default text ");
Example :
<head> <script> prompt("r4r is a best tutorial : ", " you are login on r4r totorial"); </script> </head>
output :
confirm dialog box()
The Javascript confirm box difference from a alert box ,it provides two choices for the user OK and CANCEL to confirm or reject the request its show like prompbox, but its is different from prompt box .
Syntax :
confirm ("do you want to cotinue r4r website");
Example :
<html> <body> <script> confirm ("do you want to cotinue r4r website"); </script> </body> </html>
Output :
Previous | Home | Next |