I was in need of a function to change (swap) css classes - this is what I came up with - maybe some of the prototype gurus could have a look at the function - I''m sure it needs some improvements, but basically it is working: // usage: toggle (boolean), elementId, old class, new class, tag(s) // Element.swapClassName(0,null,''oldClass'',''newClass'',''div''); // Element.swapClassName(1,null,''oldClass'',''newClass'',''div'',''p''); // Element.swapClassName(1,''elementId'',''oldClass'',''newClass'',''div''); Object.extend(Element, { swapClassName: function() { // toggle (boolean), element, from, to, tag(s) var i, j=0, x, tags, els = new Array(), args = Element.swapClassName.arguments; if ($(args[1])) { // element by id els[j] = $(args[1]); } else { // element(s) by tag name for (i = 4; i < args.length; i++) { tags = document.getElementsByTagName(args[i]); for (x = 0; x < tags.length; x++) { els[j] = tags[x]; j++; } } } // swap class name of elements for (i = 0; i < els.length; i++) { if (args[0] == 1) { // toggle class if (Element.hasClassName(els[i],args[3])) { Element.removeClassName(els[i],args[3]); Element.addClassName(els[i],args[2]); } else { Element.removeClassName(els[i],args[2]); Element.addClassName(els[i],args[3]); } } else { // don''t toggle Element.removeClassName(els[i],args[2]); Element.addClassName(els[i],args[3]); } } } }); _________________________________________________________________ Don’t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/