【JS】Intermediate1:The DOM

1.DOM(The Document Object Model)

A way to manipulate the structure and style of an HTML page.

It represents the internals of the page as the browser sees it, and allows the developer to alter it with JavaScript.

2.HTML is an XML-like structure

To access the DOM from JavaScript, the document object is used.

3.Getting an element

1)By ID

【JS】Intermediate1:The DOM

2)By Tag Name

document.getElementByTagName("a")

Returns a NodeList=an array of the DOM Elements

3)By Class Name

document.getElementByClassName

as TagName

4)By CSS Seclector

document.querySelector('#header'); =ID~~~

document.querySelectorAll(.btn);

上一篇:基于jQuery UI的tabs选项卡美化


下一篇:gameUnity 0.2 网络游戏框架(计划)