www.webdeveloper.com
Results 1 to 5 of 5

Thread: Submenu (Dropdown) not working in IE6

  1. #1
    Join Date
    Jun 2010
    Posts
    28

    Submenu (Dropdown) not working in IE6

    I don’t know if this is a HTML, CSS or JS error. But I am trying to add a dropdown menu to an already huge site and its always proven difficult due to code conflicts. I never built this site so it’s like searching for a needle in a hay stack so I left it. However the company is running out of link space and I am still waiting for the new website brief to be written by my boss.

    I have managed to find something that works, but not in IE6 as the submenus just don’t work. In FF its working but I am getting the following error:

    Code:
    Error: invalid XML attribute value
    Source File: http://hmemmah/
    Line: 2, Column: 11
    Source Code:
    <div class=
    I don’t understand it as it makes no sense to me. The site is split into aspx and html includes, so for this I am working with a HTML, CSS, JS and ASPX file. I am going to assume that the error above is from the aspx file where the head is, but this points to the

    Code:
    “<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    I am not sure I am getting this. The main code works in IE6:http://www.projectseven.com/tutorial...e/workpage.htm
    so it must be a conflict.

    ASPX CODE:

    Code:
    <&#37;@ Page Language="C#" ContentType="text/html" ResponseEncoding="UTF-8" CodeFile="index.aspx.cs" Inherits="index" %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!-- InstanceBegin template="Templates/Headmasters ASP.dwt" codeOutsideHTMLIsLocked="false" -->
    <head runat="server">
    <!-- InstanceBeginEditable name="head" -->
    <title>Professional Hairdressers - In London &amp; UK | Headmasters</title>
    <meta name="robots" content="follow"  />
    <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
    <!--#include file="/includes/css.html"-->
    
    <link href="css/p7exp.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="js/p7exp.js"></script>
    
    
    <!--[if lte IE 7]>
    <style>
    #menuwrapper, #p7menubar ul a {height: 1%;}
    a:active {width: auto;}
    </style>
    <![endif]-->

    CSS

    Code:
    #menuwrapper {
    	border-top: 1px solid #000;
    	border-bottom: 1px solid #333;
    	background-color: #909090;
    	background-image: url(../images/nav/p7exp_mbar.jpg);
    	background-repeat: repeat-x;
    	text-align:center;
    
    }
    /*Clears the floated menu items.
    Assigned to a BR tag placed just before
    menuwrapper's closing DIV tag*/
    .clearit {
    	clear: both;
    	height: 0;
    	line-height: 0.0;
    	font-size: 0;
    }
    /*
    p7menubar is the root UL and p7menubar ul applies to all the sub-menu ULs.
    We set padding and margin to zero to eliminate all indentation, turn bullets off,
    and set a font-family different from the global font-family declared for the
    body element above. This sets font for just the menu. Do not add a font-size here.
    */
    #p7menubar, #p7menubar ul {
    	padding: 0;
    	margin: 0;
    	list-style: none;
    	font-family: Arial, Helvetica, sans-serif;
    }
    /*
    Root-Level Links.  Do not change the first two properties.
    Adjust padding values to make the root links taller and to offset them
    from the left and right edges of the link box. The border right creates a
    separator between links. Font-size is set here and will apply to all menu levels.
    Font color is set to light gray.
    */
    #p7menubar a {
    	display: block;
    	text-decoration: none;
    	padding: 5px 10px 5px 10px;
    	border-right: 1px solid #333;
    	font-size: 1.4em;
    	color: #FFFFFF;
    }
    /*
    Class assigned to those Root-Level links that have associated Sub-Menus.
    The top and bottom padding assigned this element must be the same as
    that assigned to the p7menubar a element. The right padding is increased
    to accomodate the display of background image depicting a downward
    pointing arrow.
    */
    #p7menubar a.trigger {
    	padding: 5px 16px 5px 10px;
    	background-image: url(../images/nav/p7PM_dark_south.gif);
    	background-repeat: no-repeat;
    	background-position: right center;
    }
    /*
    The Root-Level list items. Floating left allows
    them to appear horizontally. Width is for IE5 Mac. The last rule in
    this style sheet will set the width for this element to auto for all
    other browsers - hiding it from IE5 Mac. The width is proportional.
    As you add and edit root menu items, you will need to test this width
    to ensure it is wide enough to accomodate all text.
    */
    #p7menubar li {
    	float: left;
    	width: 9em;
    }
    /*
    Sets width for Sub-Menu box and the List Items inside - in proportional em units. 
    This allows the sub-menu width to expand if users resize the text in their browsers.
    */
    #p7menubar li ul, #p7menubar ul li  {
    	width: 12em;
    }
    /*
    The sub-menu links. We set color and turn off the right border, which
    would otherwise be inherited from the root link rule. We set top and 
    bottom padding less than the root items and increas the left padding
    to indent the sub-menu links a small amount in from the root links.
    */
    #p7menubar ul li a  {
    	color: #565656;
    	border-right: 0;
    	padding: 3px 12px 3px 16px;
    }
    /*
    Sub-Menu Unordered Lists describes each dropdown sub-menu grouping. 
    Positioned Absolutely to allow them to appear below their root trigger.
    Set to display none to hide them until trigger is moused over.
    Background Color must be set or problems will be encountered in MSIE.
    Right and bottom borders are set to simulate a raised look.
    A gradient background image is assigned.
    */
    #p7menubar li ul {
    	position: absolute;
    	z-index:100;
    	display: none;
    	background-color: #FFFFFF;
    	border-right: 1px solid #333333;
    	border-bottom: 1px solid #333333;
    	background-repeat: repeat-x;
    }
    /*
    Changes the Text color and background color when the Root-Level
    menu items are moused over. The second selector sets color and background
    when Root-Level items are accessed with the keyboard tab key. The third
    selector sets an active state to support keyboard access in MSIE. The fourth 
    selector is assigned to IE5 and IE6 Windows via the P7_ExpMenu script.
    Note that IE7 supports hover on elements other than links and so behaves
    like Firefox, Opera, and Safari - making the menu operable even if JavaScript
    is not enabled.
    */
    #p7menubar li:hover a, #p7menubar a:focus,
    #p7menubar a:active, #p7menubar li.p7hvr a {
    	color: #000000;
    	background-color: #A8B1B7;
    }
    /*
    Set the Sub-Menu UL to be visible when its associated
    Root-Level link is moused over. The second selector is 
    assigned to IE5 and IE6 via the P7_ExpMenu script.
    */
    #p7menubar li:hover ul, #p7menubar li.p7hvr ul {
    	display: block;
    }
    /*
    Sets the Text color of the Sub-Level links when the Root-Level
    menu items are moused over. The second selector is 
    assigned to IE5 and IE6 via the P7_ExpMenu script.
    The color set should march the normal Sub-Level link color
    in the rule: #p7menubar ul li a. The background color must be
    transparent to allow the underlying gradient background on the UL
    to show through.
    */
    #p7menubar li:hover ul a, #p7menubar li.p7hvr ul a {
    	color: #000000;
    	background-color: transparent;
    }
    /*
    The normal hover class for Sub-Level links. The Important directive
    is required for older browsers. We set a background color, which shows
    over the gradient background. We set text color to white.
    */
    #p7menubar ul a:hover {
    	background-color: #606060!important;
    	color: #FFFFFF!important;
    }
    /* The single backslash \ character inside this comment
    causes IE5 Mac to ignore the following rule, which allows other
    browsers to render top-level menu items to their natural width.
    Do not edit this rule in any way. */
    #p7menubar li {width: auto;}
    HTML

    Code:
    <div id="menuwrapper">
    <div class="center">
    <ul id="p7menubar">
    <li><a href="#">Home</a></li>
    <li><a class="trigger" href="#">Trigger One</a>
    <ul>
    <li><a href="#">Sub 1.1</a></li>
    <li><a href="#">Sub 1.2</a></li>
    <li><a href="#">Sub 1.3</a></li>
    <li><a href="#">Sub 1.4</a></li>
    </ul>
    </li>
    <li><a class="trigger" href="#">Trigger Two</a>
    <ul>
    <li><a href="#">Sub 2.1</a></li>
    <li><a href="#">Sub 2.2</a></li>
    <li><a href="#">Sub 2.3</a></li>
    <li><a href="#">Sub 2.4</a></li>
    <li><a href="#">Sub 2.5</a></li>
    </ul>
    </li>
    <li><a class="trigger" href="#">Trigger Three</a>
    <ul>
    <li><a href="#">Sub 3.1</a></li>
    <li><a href="#">Sub 3.2</a></li>
    <li><a href="#">Sub 3.3</a></li>
    <li><a href="#">Sub 3.4</a></li>
    <li><a href="#">Sub 3.5</a></li>
    <li><a href="#">Sub 3.6</a></li>
    <li><a href="#">Sub 3.7</a></li>
    <li><a href="#">Sub 3.8</a></li>
    </ul>
    </li>
    </ul>
    <br class="clearit">
    </div>
    </div>
    Note this is for our Intranet.
    Last edited by hmhair; 10-14-2010 at 06:32 AM.

  2. #2
    Join Date
    Jul 2007
    Location
    Québec
    Posts
    61
    I'm not sure if this is the cause of your problem, but I think your DOCTYPE should be:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    Hope this will help ...

  3. #3
    Join Date
    Jun 2010
    Posts
    28
    Hi there

    That is what it was originally until I changed it hoping it might solve the problem.

    But from what I can see it has nothing to do with the error as to why the dropdown doesn’t work in IE6. I created a blank HTML page and started again and it still didn’t work in IE6. Could this be a CSS issue?

  4. #4
    Join Date
    Jun 2010
    Posts
    28
    Fixed it.

  5. #5
    Join Date
    Feb 2011
    Posts
    1
    I had this same problem so when I saw the last post "fixed it" I was pretty disappointed that they didn't describe how. My problem was not initializing the javascript in the body tag

    <body onLoad="P7_ExpMenu()">

    This fixed my IE6 problem. As usual hours of diagnosis for a simple fix.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles