Popup when a link is clicked (Are you sure?)

Discussion in 'HTML & Website Design' started by blackburn2413, Feb 2, 2011.

  1. #1
    Hey everyone, I have a golf tee time system I created and there is a page that displays all the tee times for the current day. On this page I have a delete button next to each time.

    When this button is clicked is there a way to open a dialog box that prompts with something like "Are you sure you want to delete this tee time?" and options "Delete Time" and "Cancel" as buttons?

    I know it can be done, just not quite sure how...


    Thx
     
    blackburn2413, Feb 2, 2011 IP
  2. max2010

    max2010 Greenhorn

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    add a javascript function in <head> section like this:

    
    <script type="text/javascript">
    function sure(){
    var msg = "Are you sure?";
    return confirm(msg);
    }
    </script>
    
    PHP:
    then you can call it in a <a> tag like this:

    <a href="yourscript.php" onclick="return sure();">click me</a>
    PHP:
    hope this helps
     
    max2010, Feb 2, 2011 IP
  3. blackburn2413

    blackburn2413 Member

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3


    Flawless, absolutely flawless. Did just what I needed.

    Thanks!
     
    blackburn2413, Feb 2, 2011 IP