HighDots Forums  

Why doesn't this work in Mozilla?

Javascript JavaScript language (comp.lang.javascript)


Discuss Why doesn't this work in Mozilla? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Feudalac!
 
Posts: n/a

Default Why doesn't this work in Mozilla? - 11-02-2005 , 10:24 AM






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

Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: Why doesn't this work in Mozilla? - 11-02-2005 , 11:52 AM








Feudalac! wrote:

Quote:
Working file at:
http://www.elma.hr/test.php

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

Anybody knows why?
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="javascriptop('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/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.