javascript alert example

javascript alert

  javascript alert examples

alert example

here are some brief examples of the javascript alert event

<a href="javascript:alert('your message here')">alert example</A>

tidy it up!

If you want to tidy up your alert message you can use \n
\n causes a line break, like a carriage return

<a href="javascript:alert('first line\n second line')">alert example</A>

multiple alerts

you can put more than one javascript alert event in a link if you use a semi colon after the close bracket

<a href="javascript:alert('your message here');alert('next message here')">multiple alerts example</A>

auto alerts

If you really want to annoy your visitors you can cause a javascript alert when the page loads just by including the onload() command in your body tag

<body onload="alert('your message here')">

or if you want the alert to occur when the user exit's the page use onUnload

« back to javascripts


html tutorial css tutorial webmaster articles link exchange