admin管理员组文章数量:1415645
In IE, I can go like:
var x = document.getElementById("header");
alert(x.all[0].tagName);
If I try that in Firefox, I get the error "all is undefined".
What is the Firefox equivalent of IE's .all
property?
In IE, I can go like:
var x = document.getElementById("header");
alert(x.all[0].tagName);
If I try that in Firefox, I get the error "all is undefined".
What is the Firefox equivalent of IE's .all
property?
2 Answers
Reset to default 7.all
is a Microsoft-specific extension to the DOM, and is not supported by any other browsers (except Opera, I believe, who simulate it in order to improve patibility with sites written for IE).
You can use things like x.children
and x.childNodes
, or x.getElementById()
and x.getElementsByTagName()
to reference elements below the current one in the tree, depending on your usage. I suspect in this case x.children
is what you're after.
all
would be the name of an array. It is not a native javascript keyword.
You may want to look at childNodes instead.
本文标签: Firefox Javascript Why does all not workStack Overflow
版权声明:本文标题:Firefox Javascript: Why does .all not work? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745241386a2649348.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论