javascript IE 10 中的 Telerik DatePicker 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14022545/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 20:31:03  来源:igfitidea点击:

Telerik DatePicker in IE 10 is not working

javascriptasp.nettelerik

提问by ihorko

In my ASP.NET site, I am using Telerik controls to bind date and time picker, and it works good in all browsers except IE 10, then I ran script debugger it says js error :

在我的 ASP.NET 站点中,我使用 Telerik 控件绑定日期和时间选择器,它在除 IE 10 之外的所有浏览器中都运行良好,然后我运行脚本调试器,它显示 js 错误:

SCRIPT5007: Unable to get property 'documentElement' of undefined or null reference Telerik.Web.UI.WebResource.axd, line 166 character 2

SCRIPT5007:无法获取未定义或空引用的属性“documentElement” Telerik.Web.UI.WebResource.axd,第 166 行字符 2

Anyone knows, how to fix this problem ?

任何人都知道,如何解决这个问题?

Thanks a lot!

非常感谢!

回答by ihorko

I added to my web.config (system.webServer) lines:

我添加到我的 web.config (system.webServer) 行:

<httpProtocol>
  <customHeaders>
    <clear />
    <add name="X-UA-Compatible" value="IE=9" />
  </customHeaders>
</httpProtocol>   

and it fixed the problem.

它解决了这个问题。

回答by ragmn

Found the solution over here

这里找到了解决方案

Insert following code inside <head>tag,

<head>标签中插入以下代码,

<meta http-equiv="x-ua-compatible" content="IE=9">

<meta http-equiv="x-ua-compatible" content="IE=9">

回答by Iain Fraser

Reposting my response in the Telerik forums:

在 Telerik 论坛中重新发布我的回复:

For those of you, like us, who reverting to compatibility mode or upgrading are not good solutions at this time, we have a JavaScript patch that has a dependency on jQuery.

对于像我们一样恢复兼容模式或升级目前都不是很好的解决方案的人,我们有一个依赖于 jQuery 的 JavaScript 补丁。

$(function(){
    if (typeof(window.$telerik.getLocation) == 'function' && Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version == 10) {
        window.$telerik.getLocation = function(a)
        {
            if (a === document.documentElement) {
                return new Sys.UI.Point(0, 0);
            }
            var offset = $(a).offset();        
            return new Sys.UI.Point(offset.left, offset.top);
        }
    }
});

One potential problem is that when a date or time picker element fades out, you can see the iframe behind it with the unstyled word "false" in it. Just something to bear in mind and watch out for if you decide to use this patch.

一个潜在的问题是,当日期或时间选择器元素淡出时,您可以看到其后面的 iframe 中带有无样式的单词“false”。如果您决定使用此补丁,请记住并注意一些事项。

During our investigation, we also noticed that this version of RadDatePicker works fine IE11, just not IE10.

在我们的调查中,我们还注意到这个版本的 RadDatePicker 可以在 IE11 中正常工作,但不能在 IE10 中正常工作。

Original post can be found here: http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/getting-a-unable-to-get-property-documentelement-of-undefined-or-null-reference-error.aspx

原始帖子可以在这里找到:http: //www.telerik.com/community/forums/aspnet-ajax/general-discussions/getting-a-unable-to-get-property-documentelement-of-undefined-or-null -reference-error.aspx

回答by Ahmed Atia

You are getting this error because it seems that you are using an earlier version of Telerik. You should consider upgrade to the latest Telerik version if you target modern browsers such as IE 10.

您收到此错误是因为您似乎使用的是较早版本的 Telerik。如果您的目标是现代浏览器(例如 IE 10),则应考虑升级到最新的 Telerik 版本。

References
Error in IE 10 due to telerik dlls Version=2009.2.826.35

由于 Telerik dll 版本 = 2009.2.826.35,IE 10 中的引用
错误

回答by Jaragua

The answer of ihorko worked fine for me. On windows 2008 server (IIS 7) do what ihorko proposed. If you work on a Windows 2003 server (IIS 6) use:

ihorko 的回答对我来说很好。在 Windows 2008 服务器 (IIS 7) 上执行 ihorko 建议的操作。如果您在 Windows 2003 服务器 (IIS 6) 上工作,请使用:

cscript adsutil.vbs set w3svc/HttpCustomHeaders "X-Powered-By: ASP.NET" "X-UA-Compatible: IE=9"

cscript adsutil.vbs 设置 w3svc/HttpCustomHeaders "X-Powered-By: ASP.NET" "X-UA-Compatible: IE=9"

You can put the line in a bat file and run it from de c:\inetpub\adminscripts folder

您可以将该行放在 bat 文件中并从 de c:\inetpub\adminscripts 文件夹中运行它

Upgrade of Telerik suite is not as simple as paying the bill and copy a new dll. New versions do behave a little different and should be tested. Layout may change when using the telerik form decorator (an earlier 'bug' on margins has been solved but when corrected by code this correction will cause layout distortion after upgrade).

Telerik 套件的升级并不像支付账单和复制一个新的 dll 那样简单。新版本的行为确实有些不同,应该进行测试。使用 Telerik 表单装饰器时,布局可能会发生变化(早期的“错误”已解决,但在通过代码更正后,此更正将在升级后导致布局失真)。

回答by Ana Sampaio

I found this post while I was looking for a solution to my DNN6 website. The error was almost the same

我在寻找 DNN6 网站的解决方案时发现了这篇文章。错误几乎相同

SCRIPT5007: Unable to get property 'documentElement' of undefined or null reference

SCRIPT5007:无法获取未定义或空引用的属性“documentElement”

I tried the solution suggested by ihorko and edited my web.config, but it didn't work for me. So let me share with you what I did to solve this: http://www.40fingers.net/WeblogsNews/Weblogs/tabid/58/ID/123/language/nl-NL/DotNetNuke-6-and-Internet-Explorer-10.aspx

我尝试了 ihorko 建议的解决方案并编辑了我的 web.config,但它对我不起作用。因此,让我与您分享我为解决此问题所做的工作:http: //www.40fingers.net/WeblogsNews/Weblogs/tabid/58/ID/123/language/nl-NL/DotNetNuke-6-and-Internet-Explorer -10.aspx

Worked great for me!

对我来说很棒!