aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/node/lastchild/index.html
blob: 72e9d6b1c5e74cda05954e268a938ca09acae60a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
title: Node.lastChild
slug: Web/API/Node/lastChild
tags:
  - Property
translation_of: Web/API/Node/lastChild
---
<p>{{APIRef()}}</p>
<h2 id="Summary" name="Summary">概述</h2>
<p><code><strong>Node.lastChild</strong></code> 是一个只读属性,返回当前节点的最后一个子节点。如果父节点为一个元素节点,则子节点通常为一个元素节点,或一个文本节点,或一个注释节点。如果没有子节点,则返回 <code>null</code></p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">var last_child = element.lastChild</pre>
<h2 id="Example" name="Example">示例</h2>
<pre class="brush: js">var tr = document.getElementById("row1");
var corner_td = tr.lastChild;
</pre>
<h2 id="Specification" name="Specification">规范</h2>
<ul>
 <li>{{Spec("http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-61AD09FB", "DOM Level 2: lastChild", "REC")}}</li>
 <li>{{Spec("http://dom.spec.whatwg.org/#dom-node-lastchild", "DOM Standard: lastChild")}}</li>
</ul>