ã¡ãã£ã¨é å¼µã£ãã®ã§èãã¦ãã ããï¼(ç¬) âã® friends.each ã§åããªãã onclick ã« get_friend(id) ãä»è¾¼ãã§åã£ã¦ãé¨åã§ãã£ããè©°ã¾ã£ããã§ãã åãã¯ããæ¸ãã¦ããã§ããã for (var i = 0; i < 3; i++) { var elm = document.createElement("div"); elm.style.width = 50; elm.style.height = 50; elm.style.backgroundColor = "#ff0000"; elm.onclick = test(i); document.getElementById("target").appendChild(elm); } function test(str) { console.log(str); } ãã㨠HTML ã表示ããç¬éã«
{{#tags}}- {{label}}
{{/tags}}