开发者

embed javascript function in html

开发者 https://www.devze.com 2023-03-31 16:47 出处:网络
I want to use a confirm box for user to check before submitting the form. I use the following form tag in my script:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消