onClick interaction with applet in Mozilla

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • For Example: John Smith

    onClick interaction with applet in Mozilla

    Hello!

    Javascript beginner here, looking for some help. I discovered this
    problem tonight while playing with my site using Mozilla. I don't have
    Netscape on this computer but I assume this problem would exisist there
    as well.

    I am interacting with a Java applet (open source, which I did not write)
    using javascript. The author of the applet has provided basic
    information regarding how javascript can be used to manipulate the applet.

    For instance, this function is defined in my javascript file:

    function setTool(tool){
    var map=top.appletf rame.document.a pplets['mapApplet'].getMap();
    map.setTool(too l);
    }

    and then an onClick is used to set the tool:

    <a href="#"><img "zoom.gif" alt="Zoom In" name="selecttoo l"
    onClick="setToo l(2)"></a>

    The frame holding the applet is named "appletfram e".

    This works perfectly well in Internet Explorer. However, in Mozilla
    (1.4), it does nothing. I get no errors, no nothing.

    Can someone offer a suggestion as to how this could be made to work with
    browsers other than IE? I have been (and continue to) search the
    javascript manuals & google, but would appreciate your help if you can
    offer any. It's rather frustrating researching a problem when the
    browser doesn't even return an error.

    Thank you!

    Newsgroup replies only, please.


  • For Example: John Smith

    #2
    Re: onClick interaction with applet in Mozilla


    Berend de Boer wrote:[color=blue][color=green][color=darkred]
    >>>>>>"For" == For Example: John Smith <none@host.inva lid> writes:[/color][/color]
    >
    >
    > For> This works perfectly well in Internet Explorer. However, in
    > For> Mozilla (1.4), it does nothing. I get no errors, no nothing.
    >
    > You mean no errors in the Javascript console of Mozilla?
    >
    >[/color]

    Well, actually...

    It seems there's nothing wrong with it, after all.

    For some reason, in Mozilla, I have to click and sort of hold the link
    for a fraction of a second - then it works. In IE I just click & move &
    it works.

    Sorry for the bother, guess it's just the way Mozilla handles the
    onClick event.

    Thanks!


    Comment

    • Laurent Bugnion, GalaSoft

      #3
      Re: onClick interaction with applet in Mozilla

      Hi,

      For Example: John Smith wrote:
      [color=blue]
      > Hello!
      >
      > Javascript beginner here, looking for some help. I discovered this
      > problem tonight while playing with my site using Mozilla. I don't have
      > Netscape on this computer but I assume this problem would exisist there
      > as well.
      >
      > I am interacting with a Java applet (open source, which I did not write)
      > using javascript. The author of the applet has provided basic
      > information regarding how javascript can be used to manipulate the applet.
      >
      > For instance, this function is defined in my javascript file:
      >
      > function setTool(tool){
      > var map=top.appletf rame.document.a pplets['mapApplet'].getMap();
      > map.setTool(too l);
      > }
      >
      > and then an onClick is used to set the tool:
      >
      > <a href="#"><img "zoom.gif" alt="Zoom In" name="selecttoo l"
      > onClick="setToo l(2)"></a>
      >
      > The frame holding the applet is named "appletfram e".
      >
      > This works perfectly well in Internet Explorer. However, in Mozilla
      > (1.4), it does nothing. I get no errors, no nothing.
      >
      > Can someone offer a suggestion as to how this could be made to work with
      > browsers other than IE? I have been (and continue to) search the
      > javascript manuals & google, but would appreciate your help if you can
      > offer any. It's rather frustrating researching a problem when the
      > browser doesn't even return an error.
      >
      > Thank you!
      >
      > Newsgroup replies only, please.[/color]

      IMG tags have no ONCLICK event handler. IE interpretes what you want to
      do and does something, whereby Mozilla reacts correctly and does
      nothing. IE often does this kind of things, which is why it's always
      better to develop in Mozilla and to check if it works in IE afterwards.

      To solve your problem, try this:

      <a href="#" onClick="setToo l(2);return false;">
      <img "zoom.gif" alt="Zoom In" name="selecttoo l"></a>

      Note however that if the applet is an OBJECT tag, you cannot script it
      in Mozilla, this is a documented error. Only APPLET tags can be scripted.

      Laurent
      --
      Laurent Bugnion, GalaSoft
      Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
      Private/Malaysia: http://mypage.bluewin.ch/lbugnion
      Support children in Calcutta: http://www.calcutta-espoir.ch

      Comment

      Working...