Web Analytics Made Easy -
StatCounter Getting a confirmation box when you click a link - CodingForum

Announcement

Collapse
No announcement yet.

Getting a confirmation box when you click a link

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting a confirmation box when you click a link

    Hi there

    having a bit of strife with javascript. What I've got is a file to delete records from my DB using php. What i need is a bit of javascript code to put within the link to bring up a confirmation box so I dont accidentally delete a record i still need or something.

    what would I put in the onClick=.... part of the link? i can't seem to get it to work. I need to get it to confirm on the page the link's on, because as soon as you get to delete.php it will delete the record anyway.

    Can anyone help?

    thanks heaps!

    Lachlan.

  • #2
    try this:
    <a href="----" onclick="return (confirm('are you sure?'))?true:false;">link</a>

    Comment

    Working...
    X