Click to See Complete Forum and Search --> : Link With Confiramtion


fvillena
08-14-2003, 04:30 AM
Hi Everyone

New to javascript and just need code that will produce an alert box when a user selects a link asking them to confirm that they want to go to that page.

It's important that the page they go to does not load before they confirm.

Much obliged

Francisco

AdamGundry
08-14-2003, 05:11 AM
I believe you want something like this:

<a href="http://www.example.com" onclick="if (!confirm('Are you sure you want to go there?')) return false;">Go somewhere</a>

Adam

fvillena
08-14-2003, 05:23 AM
Thanks for taking the time to reply, that did the trick!

Francisco

Charles
08-14-2003, 05:57 AM
You can put that more simply as:

<a href="http://www.htmlgoodies.com/" onclick="return confirm('Are you sure? That\\'s a really bad site.')">HTML Goodies</a>