Raydot
asked on
Accessing LINK properties in the DOM
Hey,
I'm trying to change a link from an image rollover. Doesn't seem to me that JS supports changing a links class...is there a way to switch to the hover class without rolling over the link? Is there another way? I'd rather not use layers, due to the x-platform differences.
Thanks,
Raydot.
I'm trying to change a link from an image rollover. Doesn't seem to me that JS supports changing a links class...is there a way to switch to the hover class without rolling over the link? Is there another way? I'd rather not use layers, due to the x-platform differences.
Thanks,
Raydot.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You never know. Every once in a while someone finds a new magic trick (which I quickly copy to my HD).
Cd&
Cd&
*LOL@Cd&*
Anyway, the way I do this is by using 2 layers. One with the main-layout, and the other one with the clicked state or mouse-over state. Both layers are exactly alike (with other words, the links and other items appear right above each other, just another color or bold or whatsoever).
Whenever needed I show the clicked-state layer. But it has a clipping rectangle set to 0,0,0,0. So, even when the layer itself is set to visible, you won't see any items. After that I am just doing a couple of calculations for which item should be shown, and set the new clipping-rectangle. Doing it this way eliminiates the need for a lot of layers for each menu-item. :-/
As you have said you do not want to use layers, but if you do want to do it this way, I might be able to give you a small sample (not from one of my projects).
regards,
CJ
Anyway, the way I do this is by using 2 layers. One with the main-layout, and the other one with the clicked state or mouse-over state. Both layers are exactly alike (with other words, the links and other items appear right above each other, just another color or bold or whatsoever).
Whenever needed I show the clicked-state layer. But it has a clipping rectangle set to 0,0,0,0. So, even when the layer itself is set to visible, you won't see any items. After that I am just doing a couple of calculations for which item should be shown, and set the new clipping-rectangle. Doing it this way eliminiates the need for a lot of layers for each menu-item. :-/
As you have said you do not want to use layers, but if you do want to do it this way, I might be able to give you a small sample (not from one of my projects).
regards,
CJ
ASKER
Right, the "webmonkey" method. No, I knew I could do it that way, I was just wondering if I missed somthing in the JS Spec. You know like document.links[].class or something like that...
Thanks, since CD was the one to first break me out of my little cloud, the points are his...
Thanks, since CD was the one to first break me out of my little cloud, the points are his...
Sorry we couldn't find any magic.
Thanks for the A.:^)
Cd&
Thanks for the A.:^)
Cd&
ASKER