ah ha! A topic that's right up my alley...
Ok, here is the minimalist script which I am using in all of my CSS menu designs to compensate for IE6's lack of support concering :hover.
Code:
cmdHover = function() {
var cmdList = document.getElementById("cmd").getElementsByTagName("LI");
for (var i=0; i<cmdList.length; i++) {
cmdList[i].onmouseover=function() {
this.className+=" cmdhover";
}
cmdList[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" cmdhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", cmdHover);
The instructions...
Save the above script as "cmdHover.js" (or whatever you want to save it as really)
Add this to the head of your page:
Code:
<script type="text/javascript" src="cmdHover.js"></script>
Then anywhere in your css which has "li:hover" needs to be copied, but the copy should replace "li:hover" with this: "li.cmdhover"
Here's an example of original css:
Code:
#cmd li:hover ul a {
color:black;
}
Now here is how the css should look using the script:
Code:
#cmd li:hover ul a, #cmd li.cmdhover ul a{
color:black;
}
Hope that helps!
Bookmarks