I want to use a confirm box for user to check before submitting the form. I use the following form tag in my script:
<form action="delete.php" method="POST" target="_blank" onsubmit="return confirm(\"Are you sure you want to delete it from the database?\");">
But it i开发者_开发问答s not working, after I click "submit" button, the "delete.php" will be executed. Can anyone help me figure out where I went wrong? I wonder is it because this "confirm" function is some sort of inline style that I need to do some reference in the <head>
tag? Thanks!
onsubmit="return confirm('Are you sure you want to delete it from the database?');"
Tested, and works. I don't think you can escape characters like that in tags.
精彩评论