SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
Dec 21, 2006, 16:55 #1
- Join Date
- Dec 2006
- Posts
- 378
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
attatched JavaScript canceled out the main JS
the site in question
This problem is for IE 6 only! Strangely it works in IE 7 and FF.
I have 2 JavaScripts on the frontpage of this site both doing 2 totally different things!
One is for the drop down menu and the other is for speech bubbles. I put the JavaScript for the speech bubbles in a seperate file and attatched it.
Code:<script type="text/javascript" src="tooltip.js"></script>
Code:<script type="text/javascript"><!--//--><![CDATA[//><!-- 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; //--><!]]></script>
The only browser thats giving me a problem is IE 6 now.. Any ideas people please?
Merry Christmas and happy new year!
-
Dec 21, 2006, 20:32 #2
- Join Date
- Apr 2006
- Posts
- 802
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The best idea is to put all your script text outside of the html,
in script elements with src attributes,
like you did with the tooltip script.
-
Dec 21, 2006, 23:01 #3
- Join Date
- Dec 2006
- Posts
- 378
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This doesnt solve the problem tho. Ive attatched the drop down menu JS now (nav.js).
Code:<script type="text/javascript" src="tooltip.js"></script> <script type="text/javascript" src="nav.js"></script>
Now ive made the nav is attatched it doesnt work in FF or IE 7. When you roll over VIEW a speech bubble it should appear but only the drop down menu works!?
I think its some sort of parent / child or primary / slave thing going on here.. Any ideas please?
-
Dec 22, 2006, 00:45 #4
- Join Date
- Mar 2005
- Location
- USA
- Posts
- 5,482
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The problem is that when you set window.onload a second time it overrides the first time you set it.
You either need to use a set of event manipulation functions, like the ones by Dean Edwards or do something like this:
Code:window.onload = function() { makeNiceTitles(); startList(); }
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
-
Dec 22, 2006, 01:11 #5
- Join Date
- Dec 2006
- Posts
- 378
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I added this code at the end of the tooltips.js and it hasnt fixed it..
Code:window.onload = function() { makeNiceTitles(); startList(); }
Code:<body onload="doSomething()">
-
Dec 22, 2006, 01:15 #6
- Join Date
- Mar 2005
- Location
- USA
- Posts
- 5,482
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You need to remove the line where you set window.onload in the other file.
Dean put that in his post to say that his script includes some code to keep that from preventing window.onload from working. It's bad practice to use inline events, especially on <body>.We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
-
Dec 22, 2006, 11:59 #7
- Join Date
- Dec 2006
- Posts
- 378
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
alright excellent thanks it works!!!!!
Merry Christmas and happy new year!!!!!
Bookmarks