У меня есть две кнопки отправки в форме, которая позволяет пользователю обновлять/удалять контент. Я хочу подтвердить всплывающее окно, только если пользователь нажимает кнопку «Удалить».
<html>
<head>
<script type="text/javascript">
function confirmation() {
// I need to know which submit button was pressed.
if (value==Delete){
var answer = confirm("Cancel?")
if (answer){
return true;
//Continue as intended
}
else{
return false
}
}
}
</script>
</head>
<body>
<form id="Edit_Data">
//form input fields go here
<input name="action" type="submit" onclick="confirmation()" value="Update">
<input name="action" type="submit" onclick="confirmation()" value="Delete">
</form>
</body>
</html>
Есть идеи?
submit
. - person VisioN   schedule 19.05.2012