View Full Version : Getting a confirmation box when you click a link

07-04-2002, 02:00 AM
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!


07-04-2002, 02:17 AM
try this:
<a href="----" onclick="return (confirm('are you sure?'))?true:false;">link</a>