[英]javaScript issue in IE but not Firefox
I have an MVC3 C# .Net web app. 我有一个MVC3 C#.Net Web应用程序。 I am firing a javaScript method of a submit button on the onclick event.
我在onclick事件上触发了一个提交按钮的javaScript方法。 It works just fine in Firefox, I see the confirm box, but not in IE 8. In IE it is always returning true and not showing the confrim box.
它在Firefox中工作正常,我看到确认框,但在IE 8中却没有。在IE中,它始终返回true,并且不显示confrim框。 Here is the javascript:
这是JavaScript:
<script type="text/javascript">
function DoCopy() {
return confirm(($("#myField").val().contains(";" + $("#myOtherField").val() + ";")));
}
</script>
Here is the button: 这是按钮:
<input type="submit" id="thePageSubmit" name="Command" value="Save" onclick="return DoCopy();" />
I am using jQuery but even when I use straight javaScript (document.forms[0].elements["myField"]) it works in Firefox but not IE. 我使用的是jQuery,但即使使用直接的javaScript(document.forms [0] .elements [“ myField”]),它也可以在Firefox中运行,但不能在IE中使用。 Any ideas?
有任何想法吗?
I found the answer at this link: It's not compatible in IE string.contains 我在此链接中找到了答案:它与IE 字符串不兼容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.