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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.