Connecting Tech Pros Worldwide Forums | Help | Site Map

Css/java navbar problems in Firefox, works in IE

Newbie
 
Join Date: Dec 2007
Posts: 5
#1: Dec 14 '07
I have tried numerous suggestions and different codes without a firm solution, so I am hoping someone can take a look at my work and pin point my problem.

I have designed a website with a css/javascript vertical navigation sidebar. It looks and functions perfectly in IE. But in FF, it appears to function but the buttons are piled on top of each other and barely visible.

The page is http://www.azureflame.com/index.php

Here is the css:
Expand|Select|Wrap|Line Numbers
  1. <style>
  2. .sidenav ul
  3. {
  4. margin: 0;
  5. padding: 0;
  6. list-style-type: none;
  7. width: 160px;
  8. border-bottom: 1px solid #ccc;
  9. }
  10.  
  11. .sidenav ul li{
  12. position: relative;
  13. }
  14.  
  15. .sidenav ul li ul{
  16. position: absolute;
  17. width: 170px;
  18. top: 0;
  19. visibility: hidden;
  20. }
  21.  
  22. .sidenav ul li a{
  23. border-style:solid;
  24. border-color:#CAC29C;
  25. border-left:1px; 
  26. border-right:1px; 
  27. border-top:1px;
  28. border-bottom:0px;
  29. display: block;
  30. overflow: auto;
  31. color: white;
  32. text-decoration: none;
  33. padding-left:5px; 
  34. padding-right:5px; 
  35. padding-top:1px; 
  36. padding-bottom:1px;
  37. background-color:#CAC29C;
  38. background-repeat: repeat-x;
  39. background-position: bottom left;
  40. background-image:url('images/site/glossyback2.jpg');
  41. }
  42.  
  43. .sidenav ul li a:visited{
  44. color: white;
  45. }
  46. .sidenav ul li a:hover{
  47. background-color: #CAC29C;
  48. background-image: url('images/site/glossyback.jpg');
  49. }
  50.  
  51. .sidenav .subfolderstyle{
  52. background-color:#CAC29C;
  53. background-repeat: repeat-x;
  54. background-position: bottom left;
  55. background-image:url('images/site/glossyback2.jpg');
  56. }
  57.  
  58. html .sidenav ul li { 
  59. float: left; height: 1%; 
  60. }
  61. html .sidenav ul li a { 
  62. height: 1%; 
  63. }
  64.  
  65. </style>
----------------------------------------------------
Here is the html:
[html]
div class="sidenav" style="width: 139; height: 53">
<ul id="sidenav">
<li><a href="http://www.azureflame.com/index.php"><font size="1">HOME</font></a></li>
<li><a href="http://www.azureflame.com/news.php"><font size="1">NEWS</font></a>
<ul><li>etc, etc...</li></ul>
</li><li><a href="http://www.azureflame.com/rss.php"><font size="1">RSS AND PODCASTS</font></a></li>
</ul>
</ul></div>[/html]
----------------------------------------------------
and here is the javascript:
Expand|Select|Wrap|Line Numbers
  1. var menuids=["sidenav"] 
  2.  
  3. function buildsubmenus(){
  4. for (var i=0; i<menuids.length; i++){
  5.   var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
  6.     for (var t=0; t<ultags.length; t++){
  7.     ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
  8.         if (ultags[t].parentNode.parentNode.id==menuids[i]) 
  9.             ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" 
  10.         else //else if this is a sub level submenu (ul)
  11.           ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" 
  12.     ultags[t].parentNode.onmouseover=function(){
  13.     this.getElementsByTagName("ul")[0].style.display="block"
  14.     }
  15.     ultags[t].parentNode.onmouseout=function(){
  16.     this.getElementsByTagName("ul")[0].style.display="none"
  17.     }
  18.     }
  19.         for (var t=ultags.length-1; t>-1; t--){ 
  20.         ultags[t].style.visibility="visible"
  21.         ultags[t].style.display="none"
  22.         }
  23.   }
  24. }
  25.  
  26. if (window.addEventListener)
  27. window.addEventListener("load", buildsubmenus, false)
  28. else if (window.attachEvent)
  29. window.attachEvent("onload", buildsubmenus)

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,577
#2: Dec 14 '07

re: Css/java navbar problems in Firefox, works in IE


Though IE does what you want, Firefox is doing what you coded. The problem is IE. You have no doctype. Without a proper doctype, IE goes into quirks mode and acts like it's 1998 rather than like modern browsers such as Firefox. See the article about doctypes under Howtos above.

You have 61 html errors and 7 CSS errors.

You use a xhtml namespace but don't declare xhtml with a doctype.
Newbie
 
Join Date: Dec 2007
Posts: 5
#3: Dec 14 '07

re: Css/java navbar problems in Firefox, works in IE


Ah-ha! Now we're getting somewhere :) Thank you for your reply. I'm already seeing results. I apparently have a whole lot of rescripting to do on the entire site, but your HOWTO articles are going to help the quality immensely!!! Funny how I always thought (until about 2 days ago) that IE was the superior browser - LOL!!!
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,577
#4: Dec 14 '07

re: Css/java navbar problems in Firefox, works in IE


Yes. IE7 is 10 years behind current web standards while all other browsers are reasonably up to date. IE is the worst browser on the planet.
Reply