onClick interaction with applet in Mozilla

  • Thread starter For Example: John Smith
  • Start date
F

For Example: John Smith

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.appletframe.document.applets['mapApplet'].getMap();
map.setTool(tool);
}

and then an onClick is used to set the tool:

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

The frame holding the applet is named "appletframe".

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

For Example: John Smith

Berend said:
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?

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!
 
L

Laurent Bugnion, GalaSoft

Hi,
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.appletframe.document.applets['mapApplet'].getMap();
map.setTool(tool);
}

and then an onClick is used to set the tool:

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

The frame holding the applet is named "appletframe".

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.

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="setTool(2);return false;">
<img "zoom.gif" alt="Zoom In" name="selecttool"></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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top