childNodes
オブジェクトの子ノードを示します。childNodes配列で指定する以外にitem()を使って指定することもできます。
構文
オブジェクト.childNodes[参照番号] オブジェクト.childNodes.item(参照番号)
例文
<html>
<head>
<title>childNodes</title>
<script type="text/javascript"><!--
function changeText() {
document.getElementById("result").childNodes[0].nodeValue = "New Text !!";
}
// --></script>
</head>
<body>
<div id="result">Sample</div>
<form>
<input type="button" value="Change Text" onClick="changeText()">
</form>
</body>
</html>
関連記事
- previousSibling
- parentNode
- nextSibling
- lastChild
- item
- insertBefore
- hasChildNodes
- getElementsByTagName
- getElementsByName
- getElementById
- firstChild
- createTextNode
- document.createElement
- cloneNode
- appendChild
スポンサーリンク





