javascript - JS: Function call over-rides my other 2 function calls? -
i trying design menu system upgrading attack skills. example, when click upgrade "strike skill", circle 3 subset skills upgrade to.
the problem running function calls. last function of similar type, seems over-ride first 2 functions, instead of filling 3 circles in numbers, instead overwrites last 2 instead. why , how can fix it?
the problem:
skills("skills", "attack1", "i"); skills("skills", "attack2", "ii"); skills("skills", "attack3", "iii");
javascript code:
function upgradebar() { menu("upgrademenu", "systemmenu"); } function menu(classid, id) { var button = dom.el("skill"); // apply div location var x = document.createelement("div"); x.setattribute("class", classid); x.setattribute("id", id); button.appendchild(x); function skills(classid, id, text){ var circle = dom.el("systemmenu"); // apply div location var x = document.createelement("div"); x.setattribute("class", classid); x.setattribute("id", id); circle.appendchild(x); dom.settext("attack1", text); } skills("skills", "attack1", "i"); skills("skills", "attack2", "ii"); skills("skills", "attack3", "iii"); }
css code:
.upgrademenu { width: 100px; height: 100px; background-color: white; border: 1px solid black; border-radius: 50px; position: relative; } #attack1 { width: 50px; height: 50px; background-color: white; border: 1px solid black; border-radius: 50px; position: absolute; top: 0; left: 0; margin-left: -10px; } #attack2 { width: 50px; height: 50px; background-color: white; border: 1px solid black; border-radius: 50px; position: absolute; top: 0; right: 0; margin-right: -10px; } #attack3 { width: 50px; height: 50px; background-color: white; border: 1px solid black; border-radius: 50px; position: absolute; bottom: 0; margin-left: 23px; margin-bottom: -10px; }
Comments
Post a Comment