appendChild

書式

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

説明

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

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</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>