【发布时间】:2015-06-12 18:35:33
【问题描述】:
我的表单中有一个提交按钮,我没有使用 onsubmit 事件,因为我要在同一个表单中添加更多提交按钮。所以我这样做:
<script type="text/javascript" src="../script/script.js"></script>
<form id="form_cad" action="my_php.php" method="post" enctype="multipart/form-data">
<input type="submit" id="submit1" value="Add" onclick="return confirmMessage();"/>
</form>
function confirmMessage()
{
var x = confirm("...");
if(x)
{
document.getElementById("my_post_value").value = "val1";
return true;
}
return false;
}
我正在使用最新版本的 Firefox、IE 和 Google Chrome,但在 Chrome 中,onclick 事件不起作用。
【问题讨论】:
-
您可以为脚本添加更多上下文吗?具体来说,与输入相比,它包含在哪里?
-
在我的 Chrome 上运行良好 - 错误消息是什么?
标签: javascript html google-chrome