Jump to content

[SOLVED] Confirm box not working.


Cagecrawler

Recommended Posts

When the player clicks on a link, I want to have a popup that checks to see if they want to delete their character.  This is the script I have at the moment:

<script language="JavaScript">
<!--
function confirm_delete()
{
var input_box=confirm("Your player will be DELETED from the game.  Are you sure you want to do this?");
if (input_box==true)
{ 
// When OK is clicked
window.location="deleteplayer.php";
}
else
{
// When Cancel is clicked
window.location="preferences.php";
}

}
-->
</script>

This is my link:

<a href=\"deleteplayer.php\" onClick=\"confirm_delete()\">[Harakiri!]</a>

It's in PHP, hence me escaping the quotation marks.

It works if it's a button, but not if it's a normal link.  Any idea why?

 

Link to comment
https://forums.phpfreaks.com/topic/36730-solved-confirm-box-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.