foo = document.getElementById("outer");
function cycleIt() {
if (client.browser.Firefox) {
foo.addEventListener("animationend", updateClassName, true);
} else {
foo.addEventListener("webkitAnimationEnd", updateClassName, true);
}
}
function updateClassName() {
var z = foo.getAttribute("class");
if ( z == "a" ) {
foo.className = "b";
} else if ( z == "b" ) {
foo.className = "c"
} else if ( z == "c" ) {
foo.className = "d"
} else {
foo.className = "a"
}
return foo;
}
有人在 Javascript 聊天频道上告诉我,我应该为多个 if then 语句制作一个哈希表。我该怎么做呢?