4 replies [Last post]
chainbreaker
Offline
newbie
Last seen: 17 years 15 weeks ago
Joined: 2005-06-20
Posts: 2
Points: 0

On one page I'm using two of the CSS list-based menus that alistapart discusses (Suckerfish Dropdowns, Hybrid CSS Dropdowns). Both menus use the same Javascript in order to function in Windows IE. Independently, both work great in Win IE. I thought I changed all of the necessary parts of the Javascript so that both could be on the same page but admittedly Javascript isn't one of my strengths so I might've missed something crucial. Right now they won't work together in Win IE but will in Win FireFox. (This website need to be Win IE compatible.) I was wondering if maybe someone could take a look at what I've got so far and offer a suggestion on how to get the two menus to work simultaneously.

http://www.chainbreaker.info/v5/windows/

Thanks a lot.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 1 day ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5344
Points: 2965

CSS List-Based Menu Not Working in Windows IE

Hi chainbreaker,
Remove both of the window.onload calls

Quote:
window.onload=startList1;
window.onload=startList2;

The at the bottom of the JavaScript use:
 
window.onload=function(){ 
startList1; 
startList2; 
}

Hope that helps

chainbreaker
Offline
newbie
Last seen: 17 years 15 weeks ago
Joined: 2005-06-20
Posts: 2
Points: 0

CSS List-Based Menu Not Working in Windows IE

Tony, thanks for your advice. Unfortunately I'm still having problems getting it to work in Windows IE. I attempted to make the replacement you suggested: http://www.chainbreaker.info/v5/windows/

Any ideas on what I keep doing wrong?

Electric
Offline
Regular
Last seen: 17 years 11 weeks ago
Joined: 2005-07-15
Posts: 50
Points: 0

CSS List-Based Menu Not Working in Windows IE

i had the exact same problem

try getting rid of the window.onload part altogether and put

<body onload="startList(); startList2();">

instead

this worked for me when i had to load 2 bits of javascript

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 7 years 50 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

CSS List-Based Menu Not Working in Windows IE

I've got two different dropdowns going on one of my sites and did this (script is a bit different from yours but was based on the Suckerfish Dropdowns):

sfHover = function() {
			var sfEls1 = document.getElementById("nav").getElementsByTagName("LI");
			for (var i=0; i<sfEls1.length; i++) {
				sfEls1[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls1[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			}
		var sfEls2 = document.getElementById("nav2").getElementsByTagName("LI");
			for (var i=0; i<sfEls2.length; i++) {
				sfEls2[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls2[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			}
		}
		if (window.attachEvent) window.attachEvent("onload", sfHover);

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference