[英]error“JavaScript runtime error: Unable to get property 'scrollLeft' of undefined or null reference” while finding scroll position
[英]JavaScript runtime error: Unable to get property 'msie' of undefined or null reference
我只是嘗試將我的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代碼似乎給出了一個錯誤,指出'dialog'對象未定義或'tooltip'對象未定義。 我認為當我嘗試將引用放在head部分時,jquery庫沒有被加載。
jQuery.browser已經在jQuery 1.9中刪除了(你使用的是1.10),所以任何將它作為對象處理的嘗試(即訪問它的msie
屬性)都注定要失敗。 如果您仍想使用它,請包含jQuery migrate plugin和jQuery
我將jquery-ui更新為1.11.3,問題就消失了。
從項目中的給定鏈接添加庫。
http://code.jquery.com/jquery-migrate-1.2.1.js
要么
在您的頁面中注冊以下鏈接
<script type="text/javascript" src="code.jquery.com/jquery-migrate-1.2.1.js"></script>
jquery-browser-plugin現在提供$ .browser對象。 包括$ .browser.msie
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.