lastChild
最後の子ノードを示します。
構文
オブジェクト.lastChild
例文
<html>
<head>
<title>lastChild</title>
<script type="text/javascript"><!--
window.onload = function () {
var cObj = document.getElementById("subBlock").lastChild;
document.getElementById("result").innerHTML = cObj.id;
}
// --></script>
</head>
<body>
<div id="result"></div>
<div id="subBlock"><div id="sub1">Sample <div id="sub2">Text</div></div></div>
</body>
</html>
関連記事
- previousSibling
- parentNode
- nextSibling
- item
- insertBefore
- hasChildNodes
- getElementsByTagName
- getElementsByName
- getElementById
- firstChild
- createTextNode
- document.createElement
- cloneNode
- childNodes
- appendChild
スポンサーリンク





