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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Drop down menu IE6

    OK guys, I'm still fairly new at this, so please be patient. I have built a drop down menu that works fine in IE7 and FF, but I cannot get the submenus to appear in EI6. I have found on the web various problems that would cause this, but can't find a solution - I've edited, and re-edited with no use. Any help would be great!

    Code follows:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <link href="/styles/front.css" rel="stylesheet" type="text/css" />
    <ul id="div">
    <style>
    startList = function() {
    if (document.all&&document.getElementById) {
    navRoot = document.getElementById("nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
    node = navRoot.childNodes[i];
    if (node.nodeName=="LI") {
    node.onmouseover=function() {
    this.className+=" over";
    }
    node.onmouseout=function() {
    this.className=this.className.replace(" over", "");
    }
    }
    }
    }
    }
    window.onload=startList;
    </style>
    <title>Simply My Sims</title>
    </head>
    <body>
    <div id="wrapper">
    <div id="header">
    <img src="/images/head.jpg" />
    <h1>&raquo; Simply My Sims &laquo; </h1>
    <h2>My little piece of the Sims 2 world...</h2>
    </div>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <div id="nav">
    <ul>
    <li><a href="/" title="home">Home</a>
    <ul>
    <li><a href="/aboutme.html" title="aboutme">About Me</a></li>
    </ul>
    </li>
    <li><a href="/" title="challenges">Challenges</a>
    <ul>
    <li><a href="/legacy/intro.html" title="legacy">Whitmore Legacy</a></li>
    <li><a href="/dhw/intro.html" title="dhw">Desperate Housewife</a></li>
    <li><a href="http://tktrn99.blogsome.com/" title="widow">Black Widow</a></li>
    <li><a href="http://tktrn99-twins.blogspot.com/" title="twins">Twin Experiment</a></li>
    </ul>
    </li>
    <li><a href="/" title="links">Links</a>
    <ul>
    <li><a href="/links/stories.html" title="stories">Sim Stories</a></li>
    <li><a href="/links/cc.html" title="cc">Custom Content</a></li>
    </ul>
    </li>
    </ul>
    </div>
    </div>
    </body>
    </html>

    CSS:
    body {
    font-family: Georgia, "Times New Roman", Times, serif;
    background:url(/images/mistytil.jpg);
    text-align: left;
    }
    #wrapper {
    width: 800px;
    margin: 0 auto;
    padding: 0;
    text-align: left;
    background-color: #FFFFFF;
    }
    #header {
    color: #C71585;
    text-align: center;
    height: 200px;
    font-family: DiMurphic;
    }
    #header img {
    position: relative;
    text-align: left;
    float: left;
    }
    #nav {
    border: 5px #6495ED solid;
    width: 150px;
    }
    #nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    width: 150px;
    border-bottom: 1px solid #ccc;
    }
    #nav ul li {
    position: relative;
    }
    #nav li ul {
    position: absolute;
    left: 145px;
    top: 0;
    display: none;
    }
    #nav ul li a {
    display: block;
    text-decoration: none;
    color: #FFFFFF;
    background: #4682B4;
    padding: 5px;
    border: 1px solid #6495ED;
    border-bottom: 0;
    }
    #nav li:hover ul, li.over ul {
    display: block;
    }

    /* Fix IE. Hide from IE Mac \*/
    * html ul li { float: left; }
    * html ul li a { height: 1%; }
    /* End */

    #main-content {
    border: 5px #A0522D solid;
    padding: 50px;
    }
    #main-text {
    border: 5px #DAA520 dashed;
    }
    #footer {
    background-color: #DEB887;
    border: 5px #808080 solid;
    text-align:center;
    }

  • #2
    Regular Coder
    Join Date
    Aug 2006
    Location
    Cardiff, UK
    Posts
    141
    Thanks
    15
    Thanked 2 Times in 2 Posts
    I'm assuming that the bit of script in the <style> tag at the top looks like it should be in a <script language="javascript" type="text/javascript"> tag, and there's some strange ordering of code with a <ul> in the middle of your <head>, which I'm assuming is a typo. At least I hope it's not deliberate, or we'll have to send you back to HTML 101...

    Also, when you post, it's customary to tag your code - if you look in the line of style icons at the top of the form you use to post, you'll see a '#' icon which wraps code tags around it.
    If anyone asks my boss, this counts as work, okay?

  • #3
    Regular Coder
    Join Date
    Aug 2006
    Location
    Cardiff, UK
    Posts
    141
    Thanks
    15
    Thanked 2 Times in 2 Posts
    This is based on the Son of Suckerfish method, from HTML Dog which is my personal favourite method.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Simply My Sims</title>
    <style type="text/css">
    body {
    	font-family: Georgia, "Times New Roman", Times, serif;
    	background:url(/images/mistytil.jpg);
    	text-align: left;
    }
    #wrapper {
    	width: 800px;
    	margin: 0 auto;
    	padding: 0;
    	text-align: left;
    	background-color: #FFFFFF;
    }
    #header {
    	color: #C71585;
    	text-align: center;
    	height: 200px;
    	font-family: DiMurphic;
    }
    #header img {
    	position: relative;
    	text-align: left;
    	float: left;
    }
    	
    #nav, #nav ul { /* all lists */
    	padding: 0;
    	margin: 0;
    	list-style: none;
    	float : left;
    	width : 150px;
    }
    
    #nav ul{
    	border: 5px #6495ED solid;
    }
    	
    #nav li { /* all list items */
    	position : relative;
    	float : left;
    	line-height : 1.25em;
    	margin-bottom : -1px;
    	width: 150px;
    }
    	
    #nav li ul { /* second-level lists */
    	position : absolute;
    	left: -999em;
    	margin-left : 150px;
    	margin-top : -2em;
    	border: 0;
    	border-bottom: 1px solid #ccc;
    }
    	
    #nav li a {
    	width: 150px;
    	w\idth : 140px;
    	display : block;
    	color : #FFFFFF;
    	text-decoration : none;
    	background-color : #4682B4;
    	padding: 5px;
    	border: 1px solid #6495ED;
    	border-bottom: 0;
    }
    	
    #nav li a:hover {
    	color : white;
    	background-color : black;
    }
    	
    #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul {
    	left: -999em;
    }
    	
    #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul { /* lists nested under hovered list items */
    	left: auto;
    }
    	
    #content {
    	margin-left : 12em;
    }
    </style>
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    
    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>
    </head>
    <body>
    <div id="wrapper">
      <div id="header"> <img src="/images/head.jpg" />
        <h1>&raquo; Simply My Sims &laquo; </h1>
        <h2>My little piece of the Sims 2 world...</h2>
      </div>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <div id="nav">
        <ul>
          <li><a href="/" title="home">Home</a>
            <ul>
              <li><a href="/aboutme.html" title="aboutme">About Me</a></li>
            </ul>
          </li>
          <li><a href="/" title="challenges">Challenges</a>
            <ul>
              <li><a href="/legacy/intro.html" title="legacy">Whitmore Legacy</a></li>
              <li><a href="/dhw/intro.html" title="dhw">Desperate Housewife</a></li>
              <li><a href="http://tktrn99.blogsome.com/" title="widow">Black Widow</a></li>
              <li><a href="http://tktrn99-twins.blogspot.com/" title="twins">Twin
                  Experiment</a></li>
            </ul>
          </li>
          <li><a href="/" title="links">Links</a>
            <ul>
              <li><a href="/links/stories.html" title="stories">Sim Stories</a></li>
              <li><a href="/links/cc.html" title="cc">Custom Content</a></li>
            </ul>
          </li>
        </ul>
      </div>
    </div>
    </body>
    </html>
    I think there's tiny bit of tweaking with the border around the navigation to be done - looks a tiny bit off at the moment. I'm going to pretend that that was deliberate and that's your homework to finish a little bit of CSS debugging.
    If anyone asks my boss, this counts as work, okay?

  • #4
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you so much! Works beautifully in IE6 now. In IE7 the submenus are left hanging once you scroll over them. Do I need to move them to the right a few pixels to prevent this? Take a look..
    http://www.simplymysims.com/front.php
    Thanks again!!

  • #5
    Regular Coder
    Join Date
    Aug 2006
    Location
    Cardiff, UK
    Posts
    141
    Thanks
    15
    Thanked 2 Times in 2 Posts
    Afraid I'm Mac-based at home, so I can't check now until after the weekend. I did check in IE7 before I left, and it looked okay, but I was concentrating on IE6, so my bad.

    I must admit, I thought there would be a few issues, as I rushed a bit, and was mixing ems (from the Son of Suckerfish article) and pixels (from your basic code) as I went. It's likely that just a tiny bit of tweaking will work fine.

    To make sure that you don't affect the implementation in FF and IE6, create a new style sheet (say 'ie7.css'), and wrap the link to it in a conditional comment. You can then make edits to the CSS that will only affect IE7.

    I hope you don't mind if I leave you to research the use of conditional comments as part of your 'homework'.
    If anyone asks my boss, this counts as work, okay?

  • #6
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks again for helping. Seems this is a son of suckerfish bug found only in IE7 - found an easy solution here: http://www.builtfromsource.com/2006/...downs-in-ie-7/

    Thanks again!


  •  

    Posting Permissions

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