Javascript Problem! Not changing the css style

Posted by mathew on Stack Overflow See other posts from Stack Overflow or by mathew
Published on 2011-02-09T13:57:21Z Indexed on 2011/02/09 15:25 UTC
Read the original article Hit count: 281

Filed under:

I have this code in JavaScript:

function change() {

        document.getElementById("mem").className = 'gif';

}

The fig and gif are like this:

a.fig {

background: #FFFFFF;

}

a.gif {

background: #000099  ;
}

and the function is used like this

<a class ="fig" id ="mem" onClick="javascript:change()" href="users" >

Where the only difference between gif and fig in CSS is that they have different background colors. The problem is that the change is only noticeable in just a second and it is not permanent!

Any ideas?

© Stack Overflow or respective owner

Related posts about JavaScript