当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > DOM 介绍

HTML DOM
DOM Input Checkbox
DOM Input File 对象
DOM Input Hidden对象
DOM Input Password 对象
DOM Input Radio 对象
DOM Input Reset 对象
DOM Input Submit 对象
DOM Input Text 对象
DOM Link 对象
DOM Location 对象
DOM Meta 对象
DOM Navigator 对象
DOM 对象
DOM Option 对象
DOM Screen 对象
DOM Select 对象
DOM Style 对象
DOM Table 对象
DOM TableData 对象
DOM TableHeader 对象

HTML DOM 中的 DOM 介绍


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1232 ::
收藏到网摘: n/a

The HTML Document Object Model (HTML DOM) defines a standard way for accessing and manipulating HTML documents.
HTML文档对象模型(HTML DOM)定义了一种访问并操作HTML文档的标准方法


What You Should Already Know
你应该已经知道哪些

Before you continue you should have a basic understanding of the following:
在你继续前你应该有下面相关方面的基础知识:

  • HTML / XHTML
  • JavaScript

If you want to study these subjects first, find the tutorials on our Home page.
如果你想先学习这些知识的话,在我们的首页寻找教程


What is the DOM?
什么是DOM?

"The W3C Document Object Model (DOM) is a platform and language neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."
“W3C文档对象模型(DOM)是一个能够让程序和脚本动态访问和更新文档内容、结构和样式的语言平台”

The W3C DOM provides a standard set of objects for representing HTML and XML documents, and a standard interface for accessing and manipulating them.
W3C DOM提供了标准的HTML和XML对象集,并有一个标准的接口来访问并操作他们

The DOM is separated into different parts (Core, XML, and HTML) and different levels (DOM Level 1/2/3):
DOM被分为不同的部分(核心,XML和HTML)和不同的版本(DOM 1/2/3)

  • Core DOM - defines a standard set of objects for any structured document
    定义了任意结构文档的标准对象集合
  • XML DOM - defines a standard set of objects for XML documents
    定义了针对XML文档的标准对象集合
  • HTML DOM - defines a standard set of objects for HTML documents
    定义了针对HTML文档的标准对象集合

What is the HTML DOM?
什么是HTML DOM?

  • The HTML DOM is the Document Object Model for HTML
    HTML DOM是针对HTML的文档对象模型
  • The HTML DOM is platform and language independent
    HTML DOM是独立的语言和平台
  • The HTML DOM defines a standard set of objects for HTML, and a standard way to access and manipulate HTML documents
    定义了针对HTML的标准对象集合以及访问和操作HTML文档的方法
  • The HTML DOM is a W3C standard
    HTML DOM是一个W3C的标准

The HTML DOM views HTML documents as a tree structure of elements embedded within other elements. All elements, their containing text and their attributes, can be accessed through the DOM tree. Their contents can be modified or deleted, and new elements can be created by the DOM. The elements, their text, and their attributes are all known as nodes.
HTML DOM将HTML文档视为嵌套其他元素的树型结构元素。所有的元素,它们包含的文字以及他们的树型都可以被DOM树所访问到。它们的内容可以修改和删除,并且可以通过DOM建立新的元素。元素的文字和它们的属性被识别为点。


We Will Use JavaScript
我们将使用JS

The HTML DOM is platform and language independent. It can be used by any programming language like Java, JavaScript, and VBScript.
HTML DOM是独立的语言平台,它可以被任何的程序语言所使用JAVA,JS,VBS)

In this tutorial we will use JavaScript.
在这个教程里我们使用的是JS


An HTML DOM Example
一个HTML DOM的例子

This coding example shows how the background color of an HTML document can be changed to yellow when a user clicks on it:
例子中的代码展示了怎样让背景颜色因用户的点击而变为黄色:

<html>

<head>
<script type="text/javascript">
function ChangeColor()
{
document.body.bgColor="yellow"
}
</script>

</head>

<body onclick="ChangeColor()">
Click on this document!
</body>

</html>

Try it yourself自己尝试下

The example above is explained in details in the next chapter of this tutorial.
上面的例子我们会在下一篇章里详细解释

评论 (0) All

登陆 | 还没注册?