novicenate Posted April 4, 2006 Share Posted April 4, 2006 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 More sharing options...
Little Goat Posted April 5, 2006 Share Posted April 5, 2006 OKuse double equals == in the if statement instead of one.the one equals asigns that value to the variable. double compares.LG Link to comment Share on other sites More sharing options...
novicenate Posted April 7, 2006 Author Share Posted April 7, 2006 excellent! thanks so much Link to comment Share on other sites More sharing options...
tuxedo210 Posted April 12, 2006 Share Posted April 12, 2006 basic knowledgeyou should read more at w3school ----> http://www.w3schools.com/js/js_operators.asp Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now