スキップメニュー:コンテンツへナビゲーションへ

乱雑モックアップ   らんざつ[乱雑] (名・形動)[文]ナリ 入り乱れていること。乱れていて秩序がないこと。また、そのさま。

element.insertBeforeとelement.appendChild

こっちもまだメモ

要素を追加する

element.appendChild(newNode)

elementにnewNodeを追加する?

js

window.onload=function(){
elm=document.getElementById("elm");
kakiku=document.createTextNode(">kakikukeko");
elm.appendChild(kakiku);
}

html

<p id="elm">aiueo</p>

output

aiueo>kakikukeko

element.insertBefore()

js

sasisu=document.createTextNode("sasisuseso>");
elm.insertBefore(sasisu,elm.firstChild);

output

sasisuseso>aiueo


コメントはまだありません »

コメントはまだありません。

この投稿へのコメントの RSS フィード。 TrackBack URL

コメントする

You can add images to your comment by clicking here.




Back to Top↑

あわせて読みたい

Back to Top↑

RSS 乱雑モックアップのフィード

Copyright © 乱雑モックアップ. All Rights Reserved.