createTextNode
テキストノード(オブジェクト)を作成しオブジェクトとして返します。
構文
オブジェクト.createTextNode(作成するテキスト) document.createTextNode(作成するテキスト)
例文
<html>
<head>
<title>createTextNode</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>
関連記事
- previousSibling
- parentNode
- nextSibling
- lastChild
- item
- insertBefore
- hasChildNodes
- getElementsByTagName
- getElementsByName
- getElementById
- firstChild
- document.createElement
- cloneNode
- childNodes
- appendChild
スポンサーリンク





