"Error on page" when loading in IE [Solved]

"Error on page" when loading in IE [Solved]

Tuesday 25 April 2006 11:18:54 am - 3 replies

Modified on Tuesday 16 May 2006 1:15:54 pm by Vidar Østevik

Author Message

Łukasz Serwatka

Wednesday 26 April 2006 12:09:31 am

Hi Vidar,

Do you use any custom JavaScript scripts in your website?

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Vidar Østevik

Wednesday 26 April 2006 8:39:13 am

Hi Lukasz!

I have no custom javascript in my webpage, but I'm running suckerfish as menu.
I guess the error is caused by "script_suckerfish.js", because the java file contains the command "getElementsById".

In line 2 there is

var sfEls = document.getElementById("nav").getElementsByTagName("LI");

And in line 16 there is

var sfEls = document.getElementById("tache_menu").getElementsByTagName("LI");

Maybe this is the problem?I'm not a skilled java programmer, so if anybody have suggestions, I would appreciate it!

I also tried to access the web page via my laptop, running XP Pro and IE 6.0.2900.2180 SP2.
And the error message did not appear here!?

Regards
Vidar

Vidar Østevik

Tuesday 16 May 2006 1:15:34 pm

If anybody have the same problem, the solution that worked for me was to remove the following lines in script_suckerfish.js

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

If you read the double_top.tpl that suckerfish uses as an override, you will find that there are not created any div called tache_menu, so the original script will return the mentioned error ("document.getElementById is null or not an oject") because there does not exist an Element called "tache_menu". So commenting this out would fix the problem!

Vidar

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.