Connecting Tech Pros Worldwide Forums | Help | Site Map

Why doesn't this work in Mozilla?

Feudalac!
Guest
 
Posts: n/a
#1: Nov 2 '05
Working file at:
http://www.elma.hr/test.php


code of menu system at:
http://www.elma.hr/test_code.htm


in mozilla drop down menus are not shown... but in IE everything works
fine...

Anybody knows why?


Please don't comment the code (i am aware that it a mess)(the same
thing written over and over again) I am trying to make it vork
everywhere and then to clean up the code...


Thanks

Martin Honnen
Guest
 
Posts: n/a
#2: Nov 2 '05

re: Why doesn't this work in Mozilla?




Feudalac! wrote:
[color=blue]
> Working file at:
> http://www.elma.hr/test.php[/color]
[color=blue]
> in mozilla drop down menus are not shown... but in IE everything works
> fine...
>
> Anybody knows why?[/color]

Yes, Mozilla's JavaScript console tells you

Error: window.event has no properties
Source File: http://www.elma.hr/test.php
Line: 33

even gives you a clickable link there that leads you directly to the
source viewer displaying the line causing that error:

function pop(me,menu) {
document.getElementById(menu).left=window.event.cl ientX

You need to pass the event object to the function e.g. change

<td width=125 id=prvim onMouseOver="javascript:pop('prvim','prvi')"

to

<td width=125 id=prvim
onmouseover="pop('prvim','prvi', event)"

and add a parameter to the function e.g.
function pop (me, menu, evt) {
then you can use e.g.
evt.clientX
in the function. The properties of the event object for mouse events are
described here:
<http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEvent>

You will have other issues however, innerText is not supported by Mozilla.

You might want to look at documents like
<http://developer.mozilla.org/en/docs/Migrate_apps_from_Internet_Explorer_to_Mozilla>
if you are serious about developing cross browser stuff.



--

Martin Honnen
http://JavaScript.FAQTs.com/
Closed Thread


Similar JavaScript / Ajax / DHTML bytes