|Previous page and Next page||Image button||Alert button|
|Prompt button||Scrolling button||Rotating button|
Creating an Alert button
On clicking the button above , you will get an alert.
- 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.:
<input TYPE=”button” VALUE=”Click me to get a free Alert 🙂 !!” onClick=”window.alert(‘Wow ! You got a free alert !!!.’); “>
<INPUT TYPE=”button” VALUE=”Are you ready ??!!”
onClick=”retval = window.confirm(‘ Are you ready ?!!?’);
window.status=(retval)?’You pressed OK’:’You pressed cancel’; “>
‘Prompt’ can be used to get user input.
Eg: Click the following button. See the status bar for results
<INPUT TYPE=”button” VALUE=”Click me to get a prompt”
onClick=”var retval = window.prompt(‘Enter some Text:’,’This is the default value. Enter some text here’);