classNameやcssTextでstyleの操作を減らすelement.style.color = "red"; element.style.fontSize = "25px"; .active { color: red; fontsize: 25px; } element.className = "active"; element.style.cssText = "color: red; fontSize: 25px;" 出典http://www.slideshare.net/nzakas/writing-efficient-javascript |
|