appendChild()のサンプル

このページのJavaScript

function add() {
  var newNode = document.createElement("LI");
  var text = document.createTextNode("追加しました。");
  newNode.appendChild(text);

  var parent = document.getElementById("sample");
  parent.appendChild(newNode);
}

このページは、「appendChild()」のサンプルプログラムです。