Welcome to Virtual Tutorial World Guest!



Alerts popups

 
Post new topic   Reply to topic    VTW Forum Index -> Javascript
View previous topic :: View next topic  
Author Message
Please Register and Login to this forum to stop seeing this advertsing.





Tokens:


Posted:     Post subject:

Back to top
Toxic
Newbie
Newbie


Joined: 22 Mar 2008
Posts: 12


Tokens: 12


PostPosted: Sat Mar 22, 2008 9:14 am    Post subject: Alerts popups Reply with quote

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.
_________________
Some kind of HTML nerd.


Last edited by Toxic on Sat Mar 22, 2008 12:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
computergeek67
Administrator
Administrator


Joined: 31 Jul 2007
Posts: 144


Tokens: 147
Location: US

PostPosted: Sat Mar 22, 2008 9:26 am    Post subject: Reply with quote

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



Come to me if you have any questions
Back to top
View user's profile Send private message Visit poster's website
Toxic
Newbie
Newbie


Joined: 22 Mar 2008
Posts: 12


Tokens: 12


PostPosted: Sat Mar 22, 2008 9:41 am    Post subject: Reply with quote

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.



_________________
Some kind of HTML nerd.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    VTW Forum Index -> Javascript All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2005 phpBB Group
Virtual Tutorial World ©2007-2008 computergeek67

Affiliates