Archive for VTW 
 


       VTW Forum Index -> Javascript
Toxic

Alerts popups

This tutorial will show you how to make an Alert popup.

Alert

The Alert popup have to be written between the <head> and the </head> tag.

Start by writing the basic tags:
Code:
<html>
<head>
<title>Whatsoever</title>
<script type="text/javascript">

</script>
</head>
<body>
</body>
</html>


To create an Alert popup, you have to remember this part:
Code:
function message()

This is placed at the top of the script part.

Now to the rest of it. Put in a "{", write "alert("Whatever-you-want-to-write")" and end with a "}".
Code:
function message()
{
alert("This is my bloody exciting alert about penguins.")
}

You can write an another "alert("")" between the previous "alert("")"-line and the ending-} if you want to display another alert after the previous alert.

End the whole thing by adding "<body some-kind-of-event,-like-for-example-onLoad,-onUnLoad-or-onDblClick="message()">" between the <body> and the </body> tag.

And the final result is:
Code:
<html>
<head>
<title>Whatsoever</title>
<script type="text/javascript">
function message()
{
alert("This is my bloody exciting alert about penguins.")
alert("They are very fuzzy.")
alert("Aren't they?")
alert("Kthxbi")
}
</script>
</head>
<body>
<body onLoad="message()">
</body>
</html>


Note: If you want to break a line (What the Enter-key does in a document), just place out ""+'\n'+"" in the sentence, like this:
Code:
alert("blablablablablablablablabla"+'\n'+"blablablablablablabla.")

This works for both the Alert and the Confirm popup.
computergeek67

Thanks for the tutorial! I might use this for HPup
Toxic

No problem. : D

I might make a tutorial for more advanced popups later too.

Edit: I added a little more. This time about how to break a line.

       VTW Forum Index -> Javascript
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum