Weitere ähnliche Inhalte
Ähnlich wie Webページで学ぶJavaScript2013 第6回
Ähnlich wie Webページで学ぶJavaScript2013 第6回 (20)
Webページで学ぶJavaScript2013 第6回
- 12. 例えば
前回の色を変える奴
var colors = ["red", "blue", "yellow", "green"],
i = 0;
profile.addEventListener("click", function() {
profile.style.backgroundColor = colors[++i % 4];
});
- 13. 例えば
前回の色を変える奴
var colors = ["red", "blue", "yellow", "green"],
i = 0;
profile.click(function() {
profile.css("background-color", colors[++i % 4]);
});
- 14. 要素の取得
● $("#id")
● $(".class")
● $("tag")
○ $("div"), $("p"), $("body")
● $("parent").find("children")
● $("something").each(function() {
$(this) // <=要素を一つずつ操作
})
● etc...