document属性
1.document和document.all
参见http://www.w3school.com.cn/htmldom/dom_obj_document.asp
如果与a,form对象,image对象,applet,input对象相对应的html标记中设定了name性质,它的值将被用作document对象的属性名,用来引用相应的对象,其他的对象则不可以。例如
<div id="aa">123456</div>
<input type="button" value="这里用 document 就出错" onclick="alert(document.aa.innerText);" />
<br />
<input type="button" value="这里用 document.all 就不出错" onclick="alert(document.all.aa.innerText);" />
另外,input等如果作为form的子元素,则直接用inputName或者document.inputName来引用此对象就是错误的,必须使用formName.inputName引用,否则就可以使用inputName来引用.例如
2.document.all的用法
3.documen的方法
getElementById()
getElementsByName()
getElementsByTagName()