focus away from the current window and forces the web browser to read the message.
clicking the button above , you will get an alert.
alerts are ideal for the following situations:
- If you want to be absolutely
sure they see a message before doing anything on the website.
- You would
like to warn the user about something.
- An error has occurred and you
want to inform the user of the problem.
- When asking the user for confirmation
of some action.
The following Source
Code will add an alert by using an HTML button and the onClick event.:
VALUE="Click me to get a free Alert :) !!" onClick="window.alert('Wow ! You got
a free alert !!!.'); ">
use of 'confirm' dialog box. This dialog box can be used for confirming something.
The confirm box is different than the alert box in that it supplies the user with
a choice, they can either press OK to confirm the popups message or they can press
cancel and not agree to the popups request.This function returns a boolean value
(true or false). If you press 'Ok', True is returned, if 'cancel' is pressed
False is returned. After clicking OK or 'cancel',
see the status bar for results.
TYPE="button" VALUE="Are you ready ??!!"
= window.confirm(' Are you ready ?!!?');
pressed OK':'You pressed cancel'; ">
'Prompt' can be used to get user input.
Eg: Click the following button. See
the status bar for results
TYPE="button" VALUE="Click me to get a prompt"
retval = window.prompt('Enter some Text:','This is the default value. Enter some