Home arrow JavaScript arrow Page 2 - Javascript Pop-up Boxes
JAVASCRIPT

Javascript Pop-up Boxes


In our last article I filled your puny brain with the knowledge of JavaScript operators. In this article we are going to learn about pop-up boxes. That's right, those sometimes annoying, sometimes helpful things that leap out at the user and ask them to do stuff will be covered here.

Author Info:
By: James Payne
Rating: 4 stars4 stars4 stars4 stars4 stars / 16
November 07, 2007
TABLE OF CONTENTS:
  1. · Javascript Pop-up Boxes
  2. · Pop-up Boxes
  3. · Confirm Box
  4. · Prompting the Prompt Box

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Javascript Pop-up Boxes - Pop-up Boxes
(Page 2 of 4 )

There are three types of Pop-up boxes in Javascript. They are the Alert Box, the Confirm Box, and the Prompt Box. Let's take a look at each one.

Alert! Will Robinson

Speaking of complexes, that kid must have had some issues. I mean every five seconds, he is sitting on some planet, chilling, and this big robot flies out of nowhere yelling Danger Will Robinson! That kid must have had a lot of changes of underwear on hand if you dig what I'm saying.

An Alert Box is used to relay information to the user. You can program them several ways. In this example we will make a simple Alert Box that displays when the page loads.


<html>

<head>

<script type="text/javascript">

alert("Look an alert box!")

</script>

</head>

<body>

</body>

</html>

If you load this page it will show a pop-up box that says Look an alert box! followed by an OK button. The user must click the OK button to continue.

If we want to add another pop-up box, we can do that also:


<html>

<head>

<script type="text/javascript">

alert("Look an alert box!")

alert("Where?!?")

</script>

</head>

<body>

</body>

</html>

This will result in the following two images:






You could also make the button say both things, using a line break:


<html>

<head>

<script type="text/javascript">

alert("Look an alert box!" + 'n' + "Where?!?")

</script>

</head>

<body>

</body>

</html>


This would result in:





blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials