CSS dropdown issues between Firefox and IE7

J

joejodihurley

Trying to do a very simple dropdown menu using CSS...a horizontal menu
with vertical dropdowns. Works perfectly in Firefox, but not so in
IE7 (imagine my frustration). I have slimmed down the program to the
lowest form possible. Essentially, it will work in both browsers when
the list is NOT an entry in a table, but will NOT work in IE if it is
in a table format. Firefox obviously accepts both formats.

I am relatively new to javascript and CSS, so I apologize if this is
an easy fix. I have spent nearly 2 weeks playing with things, and a
solution is not coming to me. I believe it is not in the javascript,
but how the CSS properties talk with IE????

Here is the the entire file...removing the commented HTML code in the
body will make it work fine in both browsers, but due to the other
code not shown, I need it to be in a table format. Thank you all in
advance for your help.

<html>
<head>

<!--
*******************************************************************************************************
-->
<!-- ************************************START OF JAVASCRIPT
************************************* -->
<!--
*******************************************************************************************************
-->

<script language="javascript" type="text/javascript">
var t=false,current;

function SetupMenu() {
if (!document.getElementsByTagName) return;
items=document.getElementsByTagName("li");
for (i=0; i<items.length; i++) {
if (items.className != "menu") continue;
thelink=findChild(items,"A");
thelink.onmouseover=ShowMenu;
thelink.onmouseout=StartTimer;
if (ul=findChild(items,"UL")) {
ul.style.display="none";
for (j=0; j<ul.childNodes.length; j++) {
ul.childNodes[j].onmouseover=ResetTimer;
ul.childNodes[j].onmouseout=StartTimer;
}
}
}
}

function findChild(obj,tag) {
cn = obj.childNodes;
for (k=0; k<cn.length; k++) {
if (cn[k].nodeName==tag) return cn[k];
}
return false;
}

function ShowMenu(e) {
if (!e) var e = window.event;
thislink = (e.target) ? e.target: e.srcElement;
ResetTimer();
if (current) HideMenu(current);
thislink = thislink.parentNode;
current=thislink;
ul = findChild(thislink,"UL");
if (!ul) return;
ul.style.display="block";
}

function HideMenu(thelink) {
ul = findChild(thelink,"UL");
if (!ul) return;
ul.style.display="none";
}

function ResetTimer() {
if (t) window.clearTimeout(t);
}

function StartTimer() {
t = window.setTimeout("HideMenu(current)",200);
}

window.onload=SetupMenu;
</script>

<!--
*******************************************************************************************************
-->
<!-- ***********************END OF JAVASCRIPT, START OF CSS
******************************** -->
<!--
*******************************************************************************************************
-->
<style type="text/css">

#menu {
position: absolute;
font-family: "GoudyOlSt BT", sans-serif;
font-size: 15;
}

#menu li {
float: left;
list-style-type: none;
width: 140px;
position: relative;
background-color: white;
border: none;
margin-left: 0px;
font-weight: bold;
}

#menu li a{
color: black;
text-decoration: none;
width: 100%;
display: block;
}

#menu li a:hover {
color: black;
}

#menu li ul {
background-color: white;
margin: 0px;
padding: 0px;
}

#menu li ul li {
padding: 0px;
margin: 0px;
float: none;
list-style-type: none;
width: 140px;
text-indent: 10px;
border: 1px solid black;
font-weight: none;
}

#menu li ul li a{
color: black;
text-decoration: none;
}

#menu li ul li a:hover{
background-color: black;
color: white;
}
</style>

<!--
*******************************************************************************************************
-->
<!-- ************************END OF CSS/HEAD, START OF
BODY******************************** -->
<!--
*******************************************************************************************************
-->
</head>


<body bgcolor="9C9C9C">
<table> <!-- Will work in IE7 if removed -->
<tr> <!-- Will work in IE7 if removed -->
<td> <!-- Will work in IE7 if removed -->
<ul id="menu">
<li class="menu"><a href="#">Item1</a>
<ul>
<li><a href="#">SubItem1-1</a></li>
<li><a href="#">SubItem1-2</a></li>
<li><a href="#">SubItem1-3</a></li>
</ul>
</li>
<li class="menu"><a href="#">Item2</a>
<ul>
<li><a href="#">SubItem2-1</a></li>
<li><a href="#">SubItem2-2</a></li>
<li><a href="#">SubItem2-3</a></li>
<li><a href="#">SubItem2-4</a></li>
</ul>
</li>
<li class="menu"><a href="#">Item3</a>
<ul>
<li><a href="#">SubItem3-1</a></li>
<li><a href="#">SubItem3-2</a></li>
</ul>
</li>
<li class="menu"><a href="#">Item4</a>
<ul>
<li><a href="#">SubItem4-1</a></li>
<li><a href="#">SubItem4-2</a></li>
</ul>
</li>
</ul>
</td> <!-- Will work in IE7 if removed -->
</tr> <!-- Will work in IE7 if removed -->
</table> <!-- Will work in IE7 if removed -->
</body>
</html>
 
M

moscarillo

(e-mail address removed) said the following on 8/23/2007 1:00 AM:


The frustration is what comes when people make incorrect assumptions
about things.

I have slimmed down the program to the


Whether I place it in a table or not IE7 shows me the same menus. So
whatever you are doing is something other than the code you posted.


Why would you post in a JS group if you thought the problem was CSS?


The best thing to do is to post two URL's. One to a table page and one
without and explain what it is you are seeing that is "different".

Try using a doctype also.


<snip>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Ran this code in IE 7 and Firefox. The menu was vertical and worked on
IE with or without the table and presented the same way with or
without the table, ie vertically. As previous mentioned this isn't a
javascript issue.
 
J

joejodihurley

Ran this code in IE 7 and Firefox. The menu was vertical and worked on
IE with or without the table and presented the same way with or
without the table, ie vertically. As previous mentioned this isn't a
javascript issue.- Hide quoted text -

- Show quoted text -

That is my problem...the menu is vertical in IE and horizontal in
Firefox. I posted in javascript because I thought that it might be a
common problem with a common javascript fix...I do appreciate your
help, so if there is anything else you can help with, that is
great...otherwise, I will look elsewhere. Thanks...
 
J

joejodihurley

(e-mail address removed) said the following on 8/23/2007 1:00 AM:


The frustration is what comes when people make incorrect assumptions
about things.

I have slimmed down the program to the


Whether I place it in a table or not IE7 shows me the same menus. So
whatever you are doing is something other than the code you posted.


Why would you post in a JS group if you thought the problem was CSS?


The best thing to do is to post two URL's. One to a table page and one
without and explain what it is you are seeing that is "different".

Try using a doctype also.


<snip>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Admittedly a bad post on my end. What is happening is that in
Firefox, it is a horizontal menu with vertical dropdowns and in IE, it
magically becomes a vertical menue with vertical dropdowns. I don't
know much about javascript, but I do know for a fact I was using the
same code in both browsers. Moreover, I wasn't sure if there was some
javascript to fix it or not, if it was a common issue, etc...thus my
reason for posting (only guessing it was CSS). I will try the doctype
suggestion and see what happens. Any additional help would be nice,
otherwise I will go elsewhere. Thanks...
 
J

joejodihurley

(e-mail address removed) said the following on 8/23/2007 9:23 AM:






Can you post sample pages that do that? In IE7 I get the same exact
menus as I get in Firefox2.0


Gotta start somewhere.


No doctype I tried made a difference but I didn't get a vertical menu in
IE7.


Ignore Thomas.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/- Hide quoted text -

- Show quoted text -

Thanks for your concern Randy (you sound genuinely concerned), but I
will figure it out on my own. It is guys like Thomas that ALWAYS
prohibit someone from learning something in these environments. Not
everyone knows everything like him...gosh, that must be nice. To his
point, I regret even posting anything. Maybe if Thomas ever gets sick
of his lonely, jaded life he can ask about how to get a date, have a
social life, or anything else reputable. Then, everyone can treat him
with as little respect as he treats others.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
oglegroups.com>, Thu, 23 Aug 2007 08:20:00, (e-mail address removed)
posted:
Maybe if Thomas ever gets sick
of his lonely, jaded life he can ask about how to get a date,

That is unhelpful. He should not be encouraged to reproduce.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
legroups.com>, Thu, 23 Aug 2007 06:23:24, (e-mail address removed)
posted:
...

Admittedly a bad post on my end. What is happening is that in
Firefox, it is a horizontal menu with vertical dropdowns and in IE, it
magically becomes a vertical menue with vertical dropdowns.


If you read the regularly-cited newsgroup FAQ, you should learn
something about not only javascript but also about how to use Usenet
newsgroups.

Your status as a Google groups user excuses only initial ignorance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top