您的位置:首页 > 其它

关于 if (document.all) ... 判断是否为ie浏览器

2013-12-12 10:13 441 查看
转自:http://bytes.com/topic/javascript/answers/92525-if-document-all

看到下面一段话:

Microsoft's Internet Explorer has a proprietary property of the documentobject that is called "all".

Writing

if (document.all)

tests whether this property is present.

Some believes that the presence of document.all implies that the browser is IE. That is no longer the case, since some other browsers have also implemented it. The only thing you can really assume after such a check, is that document.all exists (or doesn't).

In IE, document.all is an "HTML Collection" containing all elements of the page. You can write document.all['foo'] to get a reference to the element with ID="foo". The offical way to do that is document.getElementById("foo") and it is supported by IE from version
5.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: