1
LeeStewart
JavaScript error in admin Control Panel
  • 2004/8/29 2:51

  • LeeStewart

  • Just popping in

  • Posts: 10

  • Since: 2004/8/29


I'm not 100% sure of the cause, but there's Javascript problem on IE 6 (probably other browsers as well). My development machine is set up to display errors - I can ignore the problem and it continues fine.

I reproduce the problem by going to the admin Control Panel and clicking the yellow buttons on the left. Sometimes a page is loaded and there's a problem with the PHP Layers Menu (layersmenu.js): Error on line 25 - Object Expected

The problem is on the underscored line:
le="color: #000000"><?php } else if (IE4 && DOM && !Opera5 && !Konqueror) { [b][u]currentY += document.body.scrollTop;[/u][/b] }

As a test, I added a line before that:
le="color: #000000"><?php } else if (IE4 && DOM && !Opera5 && !Konqueror) { if (!document.body) alert("what the heck?"); currentY += document.body.scrollTop; }

The alert() pops up every once in a while - it looks like this JavaScript callback is being executed before the page is fully loaded.

To get around the problem, I check for the existence of the document.body object before dereferencing it:
le="color: #000000"><?php } else if (IE4 && DOM && !Opera5 && !Konqueror) { if (!document.body) return currentY += document.body.scrollTop; }

I'm not sure if anyone else has run into this, but I thought I'd share with everyone...