appendChild

指定されたオブジェクトの末尾にノードを追加します。

構文

オブジェクト.appendChild(末尾に追加するノード)

例文

<html>
 <head>
  <title>appendChild</title>
  <script type="text/javascript"><!--
  window.onload = function() {
   var textObj = document.createTextNode("DOM Sample");
   document.getElementById("result").appendChild(textObj);
  }
  // --></script>
 </head>
 <body>
 <div id="result"></div>
 </body>
</html>

関連記事

スポンサーリンク

ボールド体の文字列が前後の文字列と重なる

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

上に戻る