关于 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.
看到下面一段话:
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.
相关文章推荐
- 关于 if (document.all) ... 判断是否为ie浏览器
- if ( document.all ) 可以简单的判断浏览器是否IE浏览器?
- if (document.all&&document.getElementById) 判断浏览器是否同时支持documnet.getElementById和document.all两种表述方式(方法)
- document.all判断浏览器是否是IE
- ajax-webservice,IE11不再支持document.all来判断IE浏览器了
- struts2标签<s:if></s:if>判断session是否有值
- (rt-thread gdb)关于probe_kernel_write(判断地址是否可以写入)
- if(!xx)去判断值是否存在的问题
- 多线程操作中为什么使用while而不是if来做判断状态是否就绪
- Struts2 用 s:if test 判断String类型的对象属性值和单字符是否相等的问题
- 关于不用if,switch,?:语句判断两个数大小及其他
- 关于firefox(火狐浏览器)document.all和document.layers
- 关于”栈“:判断计算式的运算符(),[]应用是否真确的问题
- 华为2014机考题_判断if括号是否匹配_堆栈
- 关于Vue中v-show中添加表达式用于判断是否显示的问题
- 关于hibernate 是否选择关联查询(full,out,inner)时判断的一点体会
- 关于在书上学到的判断一个机器是否是大端法机器还是小端法机器的笔记
- 关于 TextField.getText()的默认值是什么 以及判断TextField.getText()里面是否有值?
- 关于链表的面试问题(判断一个单链表中是否有环)
- js判断是否ie浏览器或者浏览器版本