javascript toggle class name

this is my code for toggle class name

Working in Firefox and IE locally, working in Firefox online, NOT WORKING in IE online!!
How can it be? I have even saved page from internet (that is not working) to local pc again and  is working.

If you don't have quick fix please give me some other toggle class script.
<script type="text/javascript"> 
function changeClass(elementID, className1,className2)
{
    var elem = document.getElementById(elementID);
    elem.className = (elem.className == className1)?className2:className1;
}

</script> 

<a id="check" class="none" href="javascript:{}" onclick="showHide('somediv'); changeClass ('check','active','none')" >test</a>

Open in new window

mankisAsked:
Who is Participating?
 
hieloConnect With a Mentor Commented:
try:
<a id="check" class="none" href="#" onclick="showHide('somediv'); changeClass ('check','active','none'); return false;" >test</a>
0
 
mankisAuthor Commented:
and now is not working locally.

here is my css, just in case, but It displays without any style so it probably doesn't matter
#check{
                    width: 43px;
      height: 55px;
      padding: 0 5px 0 0;
      background: url(../images/unchecked.gif) no-repeat top left;
      display: block;
      float: left;
      text-indent:-1000px;
}
#check.active{
      background: url(../images/checked.gif) no-repeat top left;
}
0
 
mankisAuthor Commented:
it works without return false; at the end. Don't know why
thanks for helping me
0
All Courses

From novice to tech pro — start learning today.