js
This commit is contained in:
parent
0879393caf
commit
d39715f110
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
@ -0,0 +1,57 @@
|
||||
# DOM
|
||||
|
||||
## 节点层次
|
||||
|
||||
![JAVASCRIPT高级程序设计_9_DOM_节点层次- Jonathan_C - 博客园](12.dom.assets/1316408-20180226171835400-1011513544.png)
|
||||
|
||||
|
||||
|
||||
## 节点类型
|
||||
|
||||
## Document
|
||||
|
||||
> nodeType 9
|
||||
>
|
||||
> nodeName '#document'
|
||||
>
|
||||
> nodeValue null
|
||||
>
|
||||
> parentNode null
|
||||
>
|
||||
> ownerDocument null
|
||||
|
||||
```javascript
|
||||
// 获取body
|
||||
var body = document.body
|
||||
// 标题
|
||||
// 获取
|
||||
var name = document.title;
|
||||
// 修改
|
||||
document.title = "新名字"
|
||||
// 获取url
|
||||
document.URL
|
||||
// 获取域名
|
||||
document.domain
|
||||
// 获取来源
|
||||
document.referrer
|
||||
```
|
||||
|
||||
### 选择元素
|
||||
|
||||
- id
|
||||
- class
|
||||
- name
|
||||
- tagname
|
||||
|
||||
### document.getElementById()
|
||||
|
||||
### document.getElementsByClassName()
|
||||
|
||||
### document.getElementsByTagName()
|
||||
|
||||
### document.getElementsByName()
|
||||
|
||||
## 文档写入
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user