Forum Moderators: open
<script language="JavaScript">
function reset(){
document.getElementById("1").style.class = "class1";
document.getElementById("2").style.class = "class1";
document.getElementById("3").style.class = "class1";
document.getElementById("4").style.class = "class1";
document.getElementById("5").style.class = "class1";
}
</script>
<div style="height:1.2em; ">
<div id="1" class="class1" onmouseover="reset;doAnimation(this.id);this.className='rounded'" >Home</div>
<div id="2" class="class1" onmouseover="reset;doAnimation(this.id);this.className='rounded'" >link2</div>
<div id="3" class="class1" onmouseover="reset;doAnimation(this.id);this.className='rounded'" >link3</div>
<div id="4" class="class1" onmouseover="reset;doAnimation(this.id);this.className='rounded'" >link4</div>
<div id="5" class="class1" onmouseover="reset;doAnimation(this.id);this.className='rounded'">link5</div>
</div>
doAnimation is a piece of script that runs a menu as dictated by hovered upon div. Thanks for any help.
this.className='rounded'
Where this is the element. But when you are setting it in your reset function, you're doing this:
document.getElementById("1").style.class = "class1";
Where document.getElementById("1") will be the element. Notice the difference?
.style.class
vs.
.className
1. Your elements all have ID values that start with a number. You can't do that. ID values must begin with letter.
2. You are missing parenthesis after reset in your onmouseover handlers. Should be reset(); instead of reset;
3. You'll want to use the element.className="..." method for setting the class name.
Hope this helps.