View Full Version : Confirm Before Visiting Link?


Poggyuk
07-03-2003, 03:20 PM
Ok... this is what i'm trying to do...

I want to make a link, but before you can proceed to where ever the link is to, you have to confirm that you want to go there!

So: I click on the link, i get an alert pop up asking me to click ok to continue or cancel to stay where i am.

Does anybody know a script like this?

Thanks in advance! ;-)

Kaliyoda
07-03-2003, 03:40 PM
Hi

This used the "confirm" option in a JS alert box.

This needs to go in your HEAD section...



<script language="javascript" type="text/javascript">
<!--
function AlertBox2() {
if(confirm("Please confirm that you wish to enter this page"))
{
location='name-of-this-page.htm'
}
}
//-->
</script>


Then to call that function on your page use this...


<a href="the-new-page.htm" onClick="AlertBox2()">Click here to access the new page</a>