【问题标题】:javaScript issue in IE but not FirefoxIE 中的 JavaScript 问题,但不是 Firefox
【发布时间】:2013-03-18 03:23:27
【问题描述】:

我有一个 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 中无法使用。有什么想法吗?

【问题讨论】:

  • 您希望确认框包含什么?
  • 哦,为了记录,这段代码似乎也不能在 Chrome 中运行。

标签: javascript internet-explorer firefox contains


【解决方案1】:

我在这个链接找到了答案:它在 IE 中不兼容 string.contains

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-25
    • 1970-01-01
    • 2011-01-31
    • 2014-04-02
    • 1970-01-01
    相关资源
    最近更新 更多