Results 1 to 6 of 6

Thread: Popup Boxes in JavaScript

  1. #1
    Join Date
    Jan 2009
    Posts
    74

    Popup Boxes in JavaScript

    Hello, I am learning java script. Recently I had read the pop box examples in java script from my book. But, I am not able to get the exact idea about it. If anyone is having details about it, then please provide me that. Please provide me some scripts if you have. So, that I can able to get idea about the use of it.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,949

    Re: Popup Boxes in JavaScript

    JavaScript Provides you three types of Popup Box:
    • Alert box
    • Confirm box
    • Prompt box

    Alert box : Aletbox is quiet similar with the message box in the vb script. It will be used to make sure for getting input from the user. It also provide the OK button for further continue.

    Confirm Box : This Box contains the Ok and Cancel button. If use clicks on the cancel the box will return the false value. If user clicks on the Ok then true value is returned.

    Prompt Box : This box contains the OK and cancel button. If user is inputting the value then you can provide this box to user.

  3. #3
    Join Date
    May 2008
    Posts
    2,015

    Re: Popup Boxes in JavaScript

    JavaScript provides following types of Popup Boxes:

    1)Alert Box: This is just for surarity of input.
    Syntax:
    Code:
    alert("Add text Here");
    2)Confirm Box: It will verify or get some input.
    Syntax:
    Code:
    confirm("Add text Here");
    3)Prompt Box: This is used to input value before page submission.
    Syntax:
    Code:
    prompt("Add text Here","By Deault Value");

  4. #4
    Join Date
    Apr 2008
    Posts
    2,010

    Re: Popup Boxes in JavaScript

    It can be possible to use the three different types of Popup boxes withe the help of java script:
    ALERT BOX :
    • When user click on OK, he can go further.
    • Mostly used to make sure that the input is provided by the user or not.
    • It can be used to provide the warning message.

    CONFIRM BOX:
    • When user click on OK or Cancel, he can perform further task.
    • Mostly used to verify the input from the user.
    • It will ask you further processing cab be done or not.

    PROMPT BOX:
    • When user click on OK or Cancel, he can perform further task.
    • Mostly used to provide information to the user.

  5. #5
    Join Date
    May 2008
    Posts
    2,302

    Re: Popup Boxes in JavaScript

    If you are using Java Script then it may provide you three types of Pop Boxes as below:
    1. Alert box :alert("Message");
    2. Confirm box :confirm("Message");
    3. Prompt box :prompt("Message","Deault Value");

  6. #6
    Join Date
    May 2008
    Posts
    2,393

    Re: Popup Boxes in JavaScript

    Popbox script:
    Alert Box:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function alertexample()
    {
    alert("Got the message");
    }
    </script>
    </head>
    <body>
    <input type="button" onclick="alertexample()" value="Show alert box" />
    </body>
    </html>
    Confirm Box:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function confirmexample()
    {
    var check=confirm("Press ");
    if (check==true)
      {
      document.write("Ok pressed!");
      }
    else
      {
      document.write("Cancel pressed ");
      }
    }
    </script>
    </head>
    <body>
    <input type="button" onclick="confirmexample()" value="Show confirm box" />
    </body>
    </html>
    Prompt Box:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function promptexample()
    {
    var msg=prompt("Message");
    if (msg!=null && msg!="")
      {
      document.write("Got message");
      }
    }
    </script>
    </head>
    <body>
    <input type="button" onclick="promptexample()" value="Show prompt box" />
    </body>
    </html>

Similar Threads

  1. How to use CSS content boxes
    By Botan in forum Software Development
    Replies: 1
    Last Post: 08-01-2011, 11:18 AM
  2. Replies: 6
    Last Post: 11-08-2010, 12:33 PM
  3. How to nest boxes inside parent boxes in CSS?
    By Dilbert in forum Software Development
    Replies: 5
    Last Post: 11-05-2010, 04:41 PM
  4. How to Use Combo Boxes in Java?
    By MarceloQuad in forum Software Development
    Replies: 5
    Last Post: 11-02-2010, 02:23 AM
  5. How to Open Popup Window in Javascript?
    By Soumen in forum Software Development
    Replies: 4
    Last Post: 07-02-2010, 03:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •