Catch mouse specific events -- is it not possible?

J

Javier

I have a java applet that is embedded into a html page and occupies
almost the whole browser window. The applet is something like
interactive, where users can write things and click on different
buttons. One of these buttons is a stop, close one. Users can turn the
applet off through clicking on that button. My problem now is that
when the applet is turned off, the browser window, where the applet is
embedded is still open. I want that the browser window is turned off
at the same time as the applet.

I thought I could write a javascript that captures mouse specific
events such as the position and the clicks. That javascript should
catch the clicks on the "turn-off-button" of the applet.

The problem is that I am able to capture mouse movements, but it does
not work when I try to catch mousedown-events. Below is the code of my
html page. The javascript works fine when there is no applet.

Remark: To solve this problem, it has to be done through javascript,
since it is not possible to access any variables of the java applet.

I would appreciate any hint.
Thanks a lot.

--------------------------------------------------------------------------------
<html>
<head>
<script language="JavaScript">

/*-------------- caputre mousedown events--------------- */

if (document.layers) document.captureEvents(Event.MOUSEDOWN);
if (document.layers || document.all) document.onmousedown =
CaptureClick;
if (document.addEventListener) document.addEventListener('mousedown',
CaptureClick, true);

function CaptureClick(eventObject){
if (document.all){
alert(xpos + ':' + ypos);
}
}

/*------------capture mousmove events------------------*/
if (document.layers) document.captureEvents(Event.MOUSEMOVE);
if (document.layers || document.all) document.onmousemove =
mouseMoveHandler;
if (document.addEventListener) document.addEventListener('mousemove',
mouseMoveHandler, true);

function mouseMoveHandler (evt) {
var xpos = document.all ? event.clientX : document.layers ? evt.x :
evt.clientX;
var ypos = document.all ? event.clientY : document.layers ? evt.y :
evt.clientY;
window.status =xpos + ':' + ypos;
}
</script>

</head>

<body >
<APPLET NAME="" CODEBASE="" CODE="" HEIGHT="500" WIDTH="700"
ALIGN="MIDDLE">
...
...
</APPLET>
</body>
</html>
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top