similar to to this here...
http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
i know i can change each element's style's individually, but i want to change a lot of elements styles at the same time,开发者_高级运维 and the browser seems to struggle over about 40 elements.
thanks :)
Yes it can, quite easily.
$$('.someClass').addClass('newClass');
This will add newClass to every someClass element - in your case the 40 elements you have.
This is the literal answer to your question.
That said, I believe what you're really trying to do is generate a specific CSS class on the fly.
And that's something far more complicated. I suggest using this MooTools plugin: http://mootools.net/forge/p/moocss
精彩评论