Make your own free website on Tripod.com

[an error occurred while processing this directive]

Site Menu

HTML
Learn all about HTML, how to format text, add images, create tables, meta taga, and more!
.
JavaScript
Get the low down on JavaScript. See how to create popular JavaScript applications like drop down menus, clocks, dynamic messages, popup boxes, and more.
.
CGI
Concise, easy to follow introdction to CGI and how to install CGI scripts.
.
Web Design
A miscellanous section that includes various web design tutorials

 

123 Web Design!

JavaScript dialog boxes

So, what the heck are JavaScript dialog boxes? Well, they are interesting little "pop-up" boxes that can be used to display a message, ask for confirmation, user input etc. They're very easy to create, not to mention cool!

Three types of dialog boxes exist in JavaScript- alert, confirm, and prompt. I'll show you an example of each:

Alert:

<script>
alert("Welcome, my friend!")
</script>

 

Confirm:

<script>
var answer=confirm("Jump to CNN?")
if (answer)
window.location="http://cnn.com"
</script>

 

Prompt:

<script>
var answer=prompt("Please enter your name")
alert("Hello "+answer)

</script>

All of the boxes allow you to customize the message simply by entering in a different text inside the function's parentheses. Go ahead, try it now on your web page!