HTML DOM Document 对象

Document对象

每个载入浏览器的HTML文档都会成为Document对象。

Document对象使我们可愿意从脚本中对页面中的所有元素进行访问。

提示:Document对象是Window对象的一部分,可以通过window.document属性对其进行访问。

Document对象方法

  • close()  关闭使用document.open()方法打开的输出流,并显示选定的数据
  • getElementById()  返回对拥有指定id的第一个对象的引用
  • getElementsByName()   返回带有指定名称的对象集合
  • getElementsByTagName()    返回带有指定标签的对象集合
  • open()   打开一个流,一手机来自任何document.write()或document.writeIn()方法的输出
  • write()   向文档写HTML表达式 或JavaScript代码
  • writeIn()  等同于write()方法,不同的是在每个表达式之后写一个换行符
原文地址:https://www.cnblogs.com/chhom/p/7146275.html