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>

関連記事

スポンサーリンク

vipw passwdファイルを編集する

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る