firstChild

最初の子ノードを示します。

構文

オブジェクト.firstChild

例文

<html>
 <head>
  <title>firstChild</title>
  <script type="text/javascript"><!--
  window.onload = function () {
   var cObj = document.getElementById("subBlock").firstChild;
   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>

関連記事

スポンサーリンク

Vagrantで使用している秘密鍵の場所

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

上に戻る