Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2008
    Location
    Liverpool
    Posts
    53
    Thanks
    37
    Thanked 0 Times in 0 Posts

    Help! drop down menu in ie6 works with javascript, but does not validate

    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:

    Code:
    <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);
    </script>
    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

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Code:
    <script type="text/javascript">
     //<![CDATA[
      sfHover = function() {
      
      ..............
      }
     //]]>
    </script>
    or put in to an external javascript(to make life easier!).
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    snarf1974 (08-28-2008)

  • #3
    New Coder
    Join Date
    Aug 2008
    Location
    Liverpool
    Posts
    53
    Thanks
    37
    Thanked 0 Times in 0 Posts
    Thanks alot abduraooft, you seem to have all the answers


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •