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?
change()is called? Are you aware theifstatement is meaningless?ifandelseset theclassNametogif? Why haveif-elsethen?onClick="change(); return false;"the thing is that without it, the class is changed then the page is redirected.