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 ;