我有一个 MVC3 C# .Net Web 应用程序。我在 onclick 事件上触发提交按钮的 javaScript 方法。它在 Firefox 中工作得很好,我看到了确认框,但在 IE 8 中没有。在 IE 中它总是返回 true 并且不显示确认框。这是javascript:
<script type="text/javascript">
function DoCopy() {
return confirm(($("#myField").val().contains(";" + $("#myOtherField").val() + ";")));
}
</script>
这是按钮:
<input type="submit" id="thePageSubmit" name="Command" value="Save" onclick="return DoCopy();" />
我正在使用 jQuery,但即使我直接使用 javaScript (document.forms[0].elements["myField"]),它也适用于 Firefox,但不适用于 IE。有任何想法吗?