WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Accespted Javascript - Popup Boxes Sun Mar 18, 2012 5:31 am

Mr.Joker

Mr.Joker
Mr. WebArtz
Mr. WebArtz
Javascript - Popup Boxes
How to use JavaScript popup boxes


Hello again, I am Mr.Joker, and today I will teach you how to use popup boxes with javascript. Like always i have to say something about it. Popup boxes are as name say, boxes that jump out as soon as you do something on web page. You allready saw many popup boxes I am sure but there is 3 of them you have to know.

-window.alert()
-window.confirm()
-window.prompt()

Lets start from the first one.

Code:
<script type="text/javascript">
window.alert("Welcome toWebArtz");
</script>

Here we say i writen window first. Window is as you know a window, so basicly I say to web browser that window is an object (you will learn later about objects). I add dot because i want to declare what to do with a window. So i said alert. This means that as soon as this javascript is runed, a window will appear on our screen with a massage we have entered inside quotation marks. Lets move on.

Code:
<script type="text/javascript">
var x=window.confirm("Are you sure you want to leave forum?")
if (x)
document.write("Too bad.");
else
document.write("Oh great, nice choice.");
</script>

Here we start with a variable x that has value of some window that will popup confirm box on our screen with text in quotation marks. So, this variable will popup some box on the screen and ask as a question. There will be two choices, Ok and cancel. Then if i choose one of them nothing will happen. Why? Because i didnt declared what will happen yet. So i make a if&else statement. I say, If x (and x is in this case OK button by default) then write on the screen first message, if its not ok, so if its cancel button pressed then do else code. Its really simple. And here we go the last example:

Code:
<script type="text/javascript">
var x=window.prompt("What is your name?");
document.write("Your name is " + x);
</script>

We have here variable x again with value of window that will popup some prompt window. What is prompt window? Its a window that ask you a question and leave you a textbox to enter some value again. That value you enter will become value of variable x. So I say in next line that document write : "Your name is + variable x" and variable x is name you enter in prompt box. Try it and you will be stuned how simple is that Very Happy


Notice : This tutorial is copyrighted by WebArtz Forum. You may not publish it on anywhere without written permission from the administrators.

2Accespted Re: Javascript - Popup Boxes Sun Mar 18, 2012 6:02 am

Mr DarkHaxers2


Registered Member
Registered Member
nice Tutorials Mr.Joker

3Accespted Re: Javascript - Popup Boxes Fri Jul 13, 2012 11:27 am

aldoani


Registered Member
Registered Member
Wow vrey nice this TutorialsThanks

http://dowan.7olm.org/

4Accespted Re: Javascript - Popup Boxes Tue Aug 14, 2012 12:03 am

PandahFish


Registered Member
Registered Member
Where does this go....

5Accespted Re: Javascript - Popup Boxes Tue Aug 14, 2012 12:06 am

Mr.Joker

Mr.Joker
Mr. WebArtz
Mr. WebArtz
Anywhere on the page. Head tag mostly.

6Accespted Re: Javascript - Popup Boxes Tue Nov 19, 2013 12:42 am

Petermichael


Registered Member
Registered Member
nice tutorial and nice name Mr.Joker:D 

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum