Testing your Event Handler

There may be cases where ‘LiveConnect’ is not implemented (older browsers or some browser implementations on non-MS Windows platforms) which will mean JavaScript cannot call applet methods and the event handler functionality will not work. In all other cases the following methods may help in debugging potential event handler problems…

You need to make sure the MayScript and eventHandler tags are specified. If you have made a mistake with either then the following methods will help indicate where the problem lies…

isEventHandlerOK()

getEventHandlerError()

And can be used as follows…

If (!document.ViewONE.isEventHandlerOK())

{

alert(document.ViewONE.getEventHandlerError());

}

If you receive an error message when the applet attempts to call your event handler, then assuming LiveConnect is enabled, the most likely cause is that the incorrect name for your event handler was supply to ViewONE. Note that JavaScript function names are case sensitive.

The MayScript tag

The MayScript tag is required if any applet is to call JavaScript methods. This tag was introduced by Netscape and is also implemented in Internet Explorer. We have however noticed that the use of this tag can reduce start-up performance for Netscape 4 because it appears to force all applets to be recompiled with each invocation. Netscape 7 however does not suffer from this problem.

88

Page 88
Image 88
JAVA Tech VERSION 3.0 manual Testing your Event Handler, MayScript tag