Kamimura's blog
プログラミング(Python、Perl、C、Go、JavaScript)、数学、読書…
ほしい物リスト
2010年5月2日日曜日
プログラミング学習の記録 178.3 独習JavaScript (大型本)の第9章の練習問題9.2
開発環境:Mac OS X Snow Leopard+Firefox(ブラウザ)+Firebug(アドオン)
"独習JavaScript (大型本)"の第9章、p.333の練習問題9.2を解いてみる。
1.
var ul=document.getElementById("libraries"); var element=ul.getElementsByTagName("li")[1]; var s="Dojo"; if(navigator.userAgent.toLowerCase().indexOf("firefox")!=-1){ element.textContent=s; } else { element.innerText=s; }
prototype.js
script.aculo.us
jQuery
2.
var fragment=document.createDocumentFragment(); fragment.appendChild(createOption("JavaScript")); fragment.appendChild(createOption("Java")); fragment.appendChild(createOption("Ruby")); document.getElementById("languages").appendChild(fragment); function createOption(text){ var option=document.createElement("option"); option.appendChild(document.createTextNode(text)); return option; }
0 コメント:
コメントを投稿
次の投稿
前の投稿
ホーム
コメントの投稿(Atom)
0 コメント:
コメントを投稿