Results 1 to 4 of 4

Thread: Javascript OK/Cancel Message Box Example

  1. #1
    Join Date
    May 2009
    Posts
    837

    Javascript OK/Cancel Message Box Example

    Hello , Can Anybody please Give me An Example of Javascript OK/Cancel Message Box , I am Learning Java and Want to Write a small Program With Has this message box Please Help Thanks in Advance

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Javascript OK/Cancel Message Box Example

    You Can Check this Code

    <html>
    <head>
    <title>
    Test JavaScript Confirm
    </ title>

    <SCRIPT Language="JavaScript">
    <--
    securit function ()
    (
    if (confirm ( 'Do you want to visit the laboratory and Archeology Territory'))
    document.location.href = 'Techarena.in'
    )
    ->
    </ SCRIPT>

    </ head>

    <body onLoad="securit()">

    Page content
    </ body>
    </ html>
    </ body>
    </ html>

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Javascript OK/Cancel Message Box Example

    This Code might ALso work

    <HTML>
    <HEAD>
    <script Language="JavaScript">
    <!--
    function checkfields(form)
    {
    if(confirm("You left some fields empty. Are you sure you want to continue."))
    return true;
    else
    return false;
    }
    -->
    </SCRIPT>
    </HEAD>
    <BODY>
    <TABLE>
    <FORM NAME=MyForm ACTION=submit.php3 METHOD="POST" onsubmit="return checkfields
    (this);">
    <TR><TD COLSPAN="2"><INPUT NAME="submit" VALUE="Submit" TYPE="submit"></TD></TR>
    </BODY>
    </HTML>

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

    Re: Javascript OK/Cancel Message Box Example

    Hello , Here a the Structure

    if (confirm("Your question)) {
    // Code to Execute
    }


    Example

    The button above was created using the following code:
    <form name=form2>
    <input type=button value="Click Here"

    onClick="if(confirm('Go Ahead'))
    alert('You Went Ahead!');
    else alert('You Did not Went Ahead')">
    </form>

Similar Threads

  1. How to fix Excel error message cancel editing mode
    By De-Dg in forum MS Office Support
    Replies: 2
    Last Post: 24-02-2012, 06:50 PM
  2. Cancel a sending text message or MMS in Iphone 4
    By Atticus in forum Portable Devices
    Replies: 5
    Last Post: 27-04-2011, 10:27 AM
  3. Replies: 6
    Last Post: 04-10-2010, 08:13 AM
  4. How do I cancel a href in javascript?
    By MAHESA in forum Software Development
    Replies: 6
    Last Post: 13-05-2010, 11:50 PM
  5. Error Message : javascript:void(false)
    By Neel21 in forum Software Development
    Replies: 3
    Last Post: 24-08-2009, 11:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,881,698.35564 seconds with 17 queries