其实有时差不多地,不过你多试试
具体我也说不上来
document是获得文档的所有属性<a id="aaa" name="aaa">aa</a>
<script>
alert(aaa.innerText)
alert(document.all.aaa.innerText)
</script>
具体我也说不上来
document是获得文档的所有属性<a id="aaa" name="aaa">aa</a>
<script>
alert(aaa.innerText)
alert(document.all.aaa.innerText)
</script>
interface Document : Node {
readonly attribute DocumentType doctype;
readonly attribute DOMImplementation implementation;
readonly attribute Element documentElement;
Element createElement(in DOMString tagName)
raises(DOMException);
DocumentFragment createDocumentFragment();
Text createTextNode(in DOMString data);
Comment createComment(in DOMString data);
CDATASection createCDATASection(in DOMString data)
raises(DOMException);
ProcessingInstruction createProcessingInstruction(in DOMString target,
in DOMString data)
raises(DOMException);
Attr createAttribute(in DOMString name)
raises(DOMException);
EntityReference createEntityReference(in DOMString name)
raises(DOMException);
NodeList getElementsByTagName(in DOMString tagname);
};这是在DOM中的关于DOCUMENT基类的定义
attribute DOMString title;
readonly attribute DOMString referrer;
readonly attribute DOMString domain;
readonly attribute DOMString URL;
attribute HTMLElement body;
readonly attribute HTMLCollection images;
readonly attribute HTMLCollection applets;
readonly attribute HTMLCollection links;
readonly attribute HTMLCollection forms;
readonly attribute HTMLCollection anchors;
attribute DOMString cookie;
void open();
void close();
void write(in DOMString text);
void writeln(in DOMString text);
Element getElementById(in DOMString elementId);
NodeList getElementsByName(in DOMString elementName);
};
这是DOCUMENT基类在HTML中的扩展类的定义,平常我们调用的DOCUMENT就是这个类,但是不管在基类或者是扩展类中我们都找不到all这个集合属性的定义,这是为什么啊?