JavaScript
Alert Box

Back


Displays an Alert dialog with a text message and OK button.

Place this code after the BODY in your documents body tag. Change the text between the single quotes to change the message in the alert box.

Example:

<BODY onLoad="window.alert('This box is displayed every time this page is loaded!');">

Code:

onLoad="window.alert('This box is displayed every time this page is loaded!');"


A link that displays an alert dialog box.

Replace the text between the single quotes after window.alert to change the text displayed in the alert window. Change the text before the </A> to change the link text. To display the alert box and jump to another page change the text between the quotes after HREF to the URL to jump to.

Example:

A link that displays an alert dialog box.

Code:

<A HREF='javascript:window.alert("Example of a link that displays an alert box");'> link </A>


Rate this script
Excellent Acceptable Poor
Comment: