SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    question about javascript confirm

    hi javascripters,

    I want a confirm message to pop up when I click on a delete link to ask the user if they're sure they want to delete or not.

    It pops up like it's supposed to, but when I hit cancel, it does the delete anyway.

    I'm using php.

    JS:
    Code:
    <script type="text/javascript">
    <!--
    function confirmation() {
    	confirm("Are you sure? This is permanent.")
    }
    //-->
    </script>
    link:

    PHP Code:
    echo "<li>$htitle - [<a href=\"job_edit.php?job=$hid\">Edit/Show</a>] - [<a href=\"delete.php?del=job&jobid=$hid\" onclick=\"confirmation()\">Delete</a>]</li>"
    thanks for any help.
    No, I REALLY dislike having to use Joomla.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You have forgotten to return the value in both places.

    return confirm("Are you sure? This is permanent.")

    onclick=\"return confirmation()\"
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool, thanks a lot!
    No, I REALLY dislike having to use Joomla.


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
  •