Jump to content

Problems with my If...Else Statement


novicenate
 Share

Recommended Posts

I want to change the stlye of an element on mouse over and then back again on mouse out. There will be other commands to be added later, but for now this is not working. When I mouseover, the class does change to mainlinkon as I want...but when I mouseout, nothing happens and I do not get an error. What am I doing wrong????I have the following code:function menustylechange(action){if (action = 'on') { services.className = 'mainlinkon' }else { services.className = 'mainlink' }}and here is the code of the element in HTML:<li id="services" class="mainlink" onmouseover="menustylechange('on')" onmouseout="menustylechange('off')">Services</li>Thanks so much for any help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...