View Full Version : Help! drop down menu in ie6 works with javascript, but does not validate

08-27-2008, 04:25 PM
Hi all,

I feel like I've nearly cracked this, but as ever there are a few issues to be ironed out.

I've got a CSS drop down menu, it works in all the current browsers fine, but not in ie6. I managed to get it working in ie6 with some javascript:

<script language="javascript" type="text/javascript">
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
if (window.attachEvent) window.attachEvent("onload", sfHover);

However, the xhtml does not validate, is there anything I can do to modify the javascript, or is there another method to show the drop down menu in ie6

My website is: www.glentechsolutions.co.uk

Any help would be really appreciated. I'm on a steep learning curve, but will pass on my knowledge in the future.

Many Thanks

08-28-2008, 11:20 AM
<script type="text/javascript">
sfHover = function() {

</script> or put in to an external javascript(to make life easier!).

08-28-2008, 12:18 PM
Thanks alot abduraooft, you seem to have all the answers :)