Velocity Reviews

Velocity Reviews (
-   Javascript (
-   -   Catch mouse specific events -- is it not possible? (

Javier 07-20-2003 02:03 PM

Catch mouse specific events -- is it not possible?
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.

<script language="JavaScript">

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

if (document.layers) document.captureEvents(Event.MOUSEDOWN);
if (document.layers || document.all) document.onmousedown =
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 =
if (document.addEventListener) document.addEventListener('mousemove',
mouseMoveHandler, true);

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


<body >

All times are GMT. The time now is 11:50 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.