I want to have the user click on a link then have a javascript pop-up with a yes or no choice,but if yes redirect to different url if no, then stay on the same page. I tried the code below but it takes me to the same page when selecting yes or no.
function YNconfirm() {
if (window.confirm('Really go to another page?'))
{
alert("You agree")
window.location.href = (http:///mediclaim_portal/logout2.php');
}
else
{
window.location.href = (this.document);
}};
</script>
then
<a href="\mediclaim_portal/logout2.php" onclick="YNconfirm()">Home</a>
function YNconfirm() {
if (window.confirm('Really go to another page?'))
{
alert("You agree")
window.location.href = 'http:///mediclaim_portal/logout2.php';
}
}
then
<a href="/mediclaim_portal/logout2.php" onclick="YNconfirm(); return false;">Home</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With