Javascript error: document.getElementByID with IE7 and CSSMenu.js
-
websherpa
Javascript error: document.getElementByID with IE7 and CSSMenu.js
I've noticed on two sites I'm working on now with the 1.0.2 release (kudos all!) that I get the following javascript error in IE 7 if using the CSSMenu.js :
Line 15
Char: 2
Error: 'document.getElementById(...)' is null or not an object
Code: 0
URL: http://www.posseproject.ca/index.php
I used a Horizontal_dropdown : EllNav Horizontal/Verti L 2col Theme as my base.
Example here: http://www.posseproject.ca/index.php
Does this mean that it's having trouble identifying an element "primary-nav" ? Any ideas on where to look / start to fix this problem?
Many thanks.
The code of the script is:
// Javascript for the CMS CSS Menu Module
// Copyright (c) 2005 Alexander Endresen
// Released under General Public Licence
// This script will emulate the css :hover effect on the menu elements in IE
// The variables
var cssid = "primary-nav"; // CSS ID for the menuwrapper
var menuadd = "h"; // Character to be added to the specific classes upon hovering. So for example, if this is set to "h", class "menuparent" will become "menuparenth" when hovered over.
var menuh = "menuh"; // Classname for hovering over all other menu items
if (window.attachEvent) window.attachEvent("onload", cssHover);
function cssHover() {
var sfEls = document.getElementById(cssid).getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls.onmouseover=function() {
if (this.className != "") {
this.className = this.className + menuadd;
}
else {
this.className = menuh;
}
}
sfEls.onmouseout=function() {
if (this.className == menuh) {
this.className = "";
}
else {
this.className = this.className.replace(new RegExp(menuadd + "$"), "");
}
}
}
}
Line 15
Char: 2
Error: 'document.getElementById(...)' is null or not an object
Code: 0
URL: http://www.posseproject.ca/index.php
I used a Horizontal_dropdown : EllNav Horizontal/Verti L 2col Theme as my base.
Example here: http://www.posseproject.ca/index.php
Does this mean that it's having trouble identifying an element "primary-nav" ? Any ideas on where to look / start to fix this problem?
Many thanks.
The code of the script is:
// Javascript for the CMS CSS Menu Module
// Copyright (c) 2005 Alexander Endresen
// Released under General Public Licence
// This script will emulate the css :hover effect on the menu elements in IE
// The variables
var cssid = "primary-nav"; // CSS ID for the menuwrapper
var menuadd = "h"; // Character to be added to the specific classes upon hovering. So for example, if this is set to "h", class "menuparent" will become "menuparenth" when hovered over.
var menuh = "menuh"; // Classname for hovering over all other menu items
if (window.attachEvent) window.attachEvent("onload", cssHover);
function cssHover() {
var sfEls = document.getElementById(cssid).getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls.onmouseover=function() {
if (this.className != "") {
this.className = this.className + menuadd;
}
else {
this.className = menuh;
}
}
sfEls.onmouseout=function() {
if (this.className == menuh) {
this.className = "";
}
else {
this.className = this.className.replace(new RegExp(menuadd + "$"), "");
}
}
}
}
-
websherpa
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
Could it be caused if there is no Class defined for primary-nav ? I'm wondering if in the Theme I was using there is no Stylesheet defining this style, and which default stylesheet should be attached to normally define it. (If that's the problem)
Thanks.
Thanks.
-
websherpa
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
Found the problem, I think. The Theme's template was pointing to its own version of the CSSMenu.js changing it to the newer one in /modules/MenuManager/CssMenu.jss seems to have fixed the problem. Thanks for looking, I'm sure it won't be my last request. 
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
That menu is fun isn't it...
Did you notice training breaks into 2 separated lines...
and you may want to make the menu under the CSS Horizontal_dropdown : sort.. menu_horiz, submenu_horiz, and li ul, height: 22px
Did you notice training breaks into 2 separated lines...
and you may want to make the menu under the CSS Horizontal_dropdown : sort.. menu_horiz, submenu_horiz, and li ul, height: 22px
-
websherpa
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
I'm not convinced I will stick with the menu as is, luckily I don't have that many sub-levels in the final content, but it would be nice to set it up to accommocdate it.
-
Mcweb
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
I have also a probleme with the "Horizontal_dropdown" in IE and Firefox. I have made the change (for IE) : /modules/Menumanager/CssMenu.jss but i don't see the menu of second level and with FireFox the menu appears lower in the page.
I dont' find what is the problems.
My web site : http://www.tours.inra.fr/PoleSante/internet/eng/
Thanks for help
Mcweb
Sorry for my english
I dont' find what is the problems.
My web site : http://www.tours.inra.fr/PoleSante/internet/eng/
Thanks for help
Mcweb
Sorry for my english
-
websherpa
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
McWeb,
I don't think your change to the newer CssMenu.js was done correctly (the one that comes with the template needs to be exchanged for a newer one and the template changed to load the newer one), you still have a javascript error which is what is likely causing your problem.
I don't think your change to the newer CssMenu.js was done correctly (the one that comes with the template needs to be exchanged for a newer one and the template changed to load the newer one), you still have a javascript error which is what is likely causing your problem.
-
Mcweb
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
I don't understand why I have a problem with both IE and Firefox
uploads/Horizontal_dropdown/sucker.js : script for another navigator than IE
uploads/Horizontal_dropdown/CSSMenu.js : for IE
Unfortunately, I was not able to see the problem in a script
I have seen your website, the menu is good ?
McWeb
uploads/Horizontal_dropdown/sucker.js : script for another navigator than IE
uploads/Horizontal_dropdown/CSSMenu.js : for IE
Unfortunately, I was not able to see the problem in a script
I have seen your website, the menu is good ?
McWeb
-
websherpa
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
I'm not finished, but at least I'm not getting the javascript error and it drops down.
-
websherpa
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
should be to get the more current .js for the CSSMenu to fix your javascript error.Mcweb wrote: I don't understand why I have a problem with both IE and Firefox
uploads/Horizontal_dropdown/sucker.js : script for another navigator than IE
uploads/Horizontal_dropdown/CSSMenu.js : for IE
Unfortunately, I was not able to see the problem in a script
I have seen your website, the menu is good ?
McWeb
-
Mcweb
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
In the template "Horizontal_dropdown", i have :
I have another script CSSMenu.js in "/modules/Menumanager/CssMenu.jss".
I have test the two menus. It's the same thing in IE, i don't see the menus of second level...
The problem is different with Firefox and I suppose it runs with "upload/Horizontal_dropdown/sucker.js".
But, i am not able to see the probleme in the script.
This theme is hoxever very adapted to my site....
McWeb
I have another script CSSMenu.js in "/modules/Menumanager/CssMenu.jss".
I have test the two menus. It's the same thing in IE, i don't see the menus of second level...
The problem is different with Firefox and I suppose it runs with "upload/Horizontal_dropdown/sucker.js".
But, i am not able to see the probleme in the script.
This theme is hoxever very adapted to my site....
McWeb
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
I think you are missing part of it...
yours...
Research Unit "Infect
mine...
Home @ MultiInTech
yours...
Research Unit "Infect
mine...
Home @ MultiInTech
-
Mcweb
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
I have tried your solution, but, unfortunately it is the same thing : I don't see the menus of second level in IE.
Thanks for help
McWeb
Thanks for help
McWeb
-
websherpa
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
I'm not certain what the issue with IE6 is, but you should put in
as recommended above (it hasn't been doen yet). I have discovered that the tempalte is an old one and it's styling is not well worked out for the new IE browsers, plus if the secondary menu items get to certain lengths, the menus don't know how to move the rest of hte page downwards so it ends up being a mad dog's breakfast.
It would be useful to me to have someone look through my menu code and fix it up for a fee if it's possible.
as recommended above (it hasn't been doen yet). I have discovered that the tempalte is an old one and it's styling is not well worked out for the new IE browsers, plus if the secondary menu items get to certain lengths, the menus don't know how to move the rest of hte page downwards so it ends up being a mad dog's breakfast.
It would be useful to me to have someone look through my menu code and fix it up for a fee if it's possible.
Re: Javascript error: document.getElementByID with IE7 and CSSMenu.js
It works here..
http://themes.cmsmadesimple.org/horizontal_ellnav.html
I set it up so I may be able to help you get yours working...
http://themes.cmsmadesimple.org/horizontal_ellnav.html
I set it up so I may be able to help you get yours working...

