1、為ScriptManager添加腳本引用,不從ScriptResource.axd中加載MicrosoftAjax.js腳本,而是直接加載
< asp:ScriptManager ID ="ScriptManager1" runat ="server" EnablePageMethods ="true" >
< Scripts >
<asp:ScriptReference Name="MicrosoftAjax.js" ScriptMode="auto" Path="~/ScriptLibrary/System.Web.Extensions/1.0.61025.0/MicrosoftAjax.js" />
</ Scripts >
</ asp:ScriptManager >
2、修改MicrosoftAjax.debug.js
删除
switch (Sys.Browser.agent)
{
case Sys.Browser.InternetExplorer:與
case Sys.Browser.Safari: 之間的腳本,替換為如下腳本:
Sys.UI.DomElement.getLocation = function (element)
{
if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0);
var clientRect = element.getBoundingClientRect();
if (!clientRect)
{
return new Sys.UI.Point(0,0);
}
var ownerDocument = element.document.documentElement;
var offsetX = clientRect.left - 2 + ownerDocument.scrollLeft,
offsetY = clientRect.top - 2 + ownerDocument.scrollTop;
try
{
var f = element.ownerDocument.parentWindow.frameElement || null;
if (f)
{
var offset = 2 - (f.frameBorder || 1) * 2;
offsetX += offset;
offsetY += offset;
}
}
catch(ex)
{
}
return new Sys.UI.Point(offsetX, offsetY);
}
break ;