Why doesn't this work in Mozilla?

Discussion in 'Javascript' started by Feudalac!, Nov 2, 2005.

  1. Feudalac!

    Feudalac! Guest

    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
     
    Feudalac!, Nov 2, 2005
    #1
    1. Advertising

  2. Feudalac! wrote:

    > 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.clientX

    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/
     
    Martin Honnen, Nov 2, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tomer
    Replies:
    2
    Views:
    482
    Tomer
    Feb 9, 2005
  2. Replies:
    1
    Views:
    401
    Andrew Thompson
    Jan 13, 2005
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    982
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,228
    Smokey Grindel
    Dec 2, 2006
  5. pschrader
    Replies:
    1
    Views:
    349
    pschrader
    Oct 6, 2003
Loading...

Share This Page