Sonal bisla
13itu042
JavaScript
JavaScript is a scripting language produced by
Netscape for use within HTML Web pages.
JavaScript is an inter...
Popup Boxes
JavaScript has three kind of popup boxes:
Alert box
Confirm box
Prompt box
Alert Popup Boxes
An alert box is often used if you want to make sure
information comes through the user.
When an alert ...
Alert Box Example
<html>
<head>
<center>
<script type="text/javascript">
function show_alert()
{
alert("Hey I am a javascr...
Output
Confirm Popup Boxes
A confirm box is often used if you want the user to verify or
accept something.
When a confirm box p...
Confirm Box Example
<html>
<head>
<title>Alert</title>
<script type="text/javascript">
function show_confirm()
{
var r=con...
Output
Prompt Popup Boxes
A prompt box is often used if you want the user to input a
value before entering a page.
When a promp...
Prompt Box Example
Code Output
<html>
<head>
<script type="text/javascript">
prompt("visit the
site“,"www.google.com");
</...
Popup boxes
Popup boxes
of 13

Popup boxes

This presentation is all about popup boxes and their examples.
Published on: Mar 4, 2016
Published in: Engineering      
Source: www.slideshare.net


Transcripts - Popup boxes

  • 1. Sonal bisla 13itu042
  • 2. JavaScript JavaScript is a scripting language produced by Netscape for use within HTML Web pages. JavaScript is an interpreted language means that scripts execute without preliminary compilation. Everyone can use JavaScript without purchasing a license. JavaScript is a case-sensitive language. JavaScript is a dynamic computer programming language, sometimes used for game development and for the creation of desktop and mobile applications and much more.
  • 3. Popup Boxes JavaScript has three kind of popup boxes: Alert box Confirm box Prompt box
  • 4. Alert Popup Boxes An alert box is often used if you want to make sure information comes through the user. When an alert box pops up, the user will have to click "OK" to proceed. The syntax for an alert box is: alert("yourtext"); Examples could be warnings of any kind. (Typical examples are "Adult Content", or technical matters like "This site requires Shockwave Flash plug- in").
  • 5. Alert Box Example <html> <head> <center> <script type="text/javascript"> function show_alert() { alert("Hey I am a javascript alert box"); } </script> </head> <body> <input type="button" onclick="show_alert()" value="Display secret message!"> </center> </body> </html>
  • 6. Output
  • 7. Confirm Popup Boxes A confirm box is often used if you want the user to verify or accept something. When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false. The syntax for a confirm box is: confirm("yourtext"); Examples could be age verification like "Confirm that you are at least 57 years old" or technical matters like "Do you have a plug-in for Shockwave Flash?"
  • 8. Confirm Box Example <html> <head> <title>Alert</title> <script type="text/javascript"> function show_confirm() { var r=confirm("press a button"); if(r==true) { alert("You pressed ok!"); } else { alert("You pressed cancel!"); } } </script> </head> <body> <input type="button" onclick="show_confirm()" value="show confirm box" /> </body> </html>
  • 9. Output
  • 10. Prompt Popup Boxes A prompt box is often used if you want the user to input a value before entering a page. When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null. The prompt box syntax is: prompt("yourtext","defaultvalue"); Examples could be entering user's name to be stored in a cookie or entering a password or code of some kind.
  • 11. Prompt Box Example Code Output <html> <head> <script type="text/javascript"> prompt("visit the site“,"www.google.com"); </script> </head> </body>

Related Documents