SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Confirmation box for delete?

    Hi guys,

    I need little help here,
    I have the codes here,
    Code:
    <!DOCTYPE html>
    <html>
    <body>
    
    <p>Click the button to display a confirm box.</p>
    
    <button onclick="myFunction()">Try it</button>
    
    <p id="demo"></p>
    
    <script>
    function myFunction()
    {
    var x;
    var r=confirm("Press a button!");
    if (r==true)
      {
      x="You pressed OK!";
      }
    else
      {
      x="You pressed Cancel!";
      }
    document.getElementById("demo").innerHTML=x;
    }
    </script>
    
    </body>
    </html>
    The codes above is just a confirmation box.
    What I wanted here is to apply this into delete URL.
    Whenever I click the delete link this confirmation box will popup (YES or NO).
    When YES is clicked it will continue to delete.
    If NO is clicked it will simply cancel.

    This is just basic really.

    Thanks in advance.
    Quality codes are optimized and tested...
    Click here for inspiration..

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    You need to add a return false; statement to the script after x="You pressed Cancel!";
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •