I need to reproduce the confirmation window shown in the following site. It is for following an outside link. http://www.cunamutual.com/cmg/home/ (just click on any outside link to see the window). This should be simple...HAH! Any help would be greatly appreciated!!
function confirmation() { var answer = confirm("Leave mywebsite.com??") if (answer){ return true; } else{ alert("Thanks for sticking around!") } } Code (markup): onclick="confirmation()" Code (markup):
thank you, but I need to attach this to a link...they click the link then they get the window. then depending on the answer, they are either redirected to the outside link stay on the page they were on originally.... any thoughts??
You forgot the "return false;" if they don't confirm. function confirmation() { var answer = confirm("Leave mywebsite.com??") if (answer){ return true; } else{ alert("Thanks for sticking around!") return false; } }
I am still doing something wrong. I am VERY new to this and apparantly very confused! How do I join all the info given above together so it works??? Every way I have tried doesn't work....UGH and I have been unable to find an existing script that works... Thank you to all who have attempted to help!!