Does className exist in Mootools ?

Posted by anna mae on Stack Overflow See other posts from Stack Overflow or by anna mae
Published on 2010-06-04T09:58:56Z Indexed on 2010/06/05 11:32 UTC
Read the original article Hit count: 259

Filed under:
|

Hi, I want to update this very simple JS to Mootools 1.2 and it's not easy. This function :

function changeclass(x){

                document.getElementById("content").className = "ziclass0";
                document.getElementById("content").className = "ziclass" + x; 

            }

is triggered in the DOM by :

<div id="someclass">
        a href="javascript: changeclass(0)">Unstyled</a
        a href="javascript: changeclass(1)">link one</a
        a href="javascript: changeclass(2)">link two</a
        a href="javascript: changeclass(3)">link three</a
</div>

to call the according CSS classes like :

.ziclass1 h1{
            color: rgb(142,11,0);
            font-family: Verdana;
            font-size: 2.5em;
            letter-spacing: 0.1em;

        }

and changes the layout accordingly in :

<div id="content" class="ziclass3"> ...  </div>

I know I can add an event to the triggers like :

        $(#someclass.each(function(element,index) {
        element.addEvent('click', function(){
        //some code
        });

But, how do I get #content class classname ?

Through an array ?

I am a bit confused here.

I'd be really grateful for any help to set me on the right track

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about mootools