c# - JavaScript 运行时错误 : Unable to get property 'msie' of undefined or null reference

标签 c# javascript jquery asp.net jquery-ui

我刚刚尝试更改我对母版页的 jquery ui 引用。我只在 Internet Explorer 上收到上述错误。 我在 Firefox 和 Chrome 上没有收到错误。

这是抛出错误的 jquery 代码:

return a.browser.msie?(b=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),b<c?a(window).width()+"px":b+"px"):a(document).width()+"px"},resize:function(){var b=a([]);a.each(a.ui.dialog.overlay.instances,function()

我有下面的母版页:

<head id="Head1" runat="server">
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css"
        type="text/css" />
    <asp:ContentPlaceHolder ID="ExtraHeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>


 <form id="form2" runat="server">
    <asp:ScriptManager ID="ScriptManagerService" runat="server">
        <Scripts>
            <asp:ScriptReference Path="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ScriptMode="Auto" />
            <asp:ScriptReference Path="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" ScriptMode="Auto" />
        </Scripts>
    </asp:ScriptManager>
</form>
</body>

请让我知道我需要做什么? 我尝试将 jquery 引用放在 head 部分,但我的 aspx 文件中的 jquery 代码似乎给出了一个错误,指出“对话框”对象未定义或“工具提示”对象未定义。我认为当我尝试将引用放在 head 部分时,jquery 库没有加载。

最佳答案

jQuery.browser一直removed在 jQuery 1.9 中(您使用的是 1.10),因此任何将其作为对象处理的尝试(即访问其 msie 属性)注定会失败。如果您仍想使用它,请包含 jQuery migrate与 jQuery 一起使用的插件

关于c# - JavaScript 运行时错误 : Unable to get property 'msie' of undefined or null reference,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19100085/

相关文章:

c# - 哪些 DateTime 格式对 <time> 元素有效?

c# - 在同一进程中处理消息并将其发送到云端而不丢失数据的良好设计是什么?

javascript - 如何使用或运算符返回值?

javascript - 在 JQuery ajax beforeSend 中调用模态对话框收集一些信息

javascript - 如何使用 html5 和 jQuery 播放所有音频源

c# - 带有 WellKnownText 空间数据列的 SqlBulkCopy DataTable

javascript - 计算日期表单下拉列表月份天数的最佳方法

javascript - jQuery用户定义的动态表

jquery - IE7中jquery的问题

c# - 在不使用另一个变量的情况下交换两个数字