The information in this article applies to:
SUMMARY
In Internet Explorer 3.0x, there is no way for a Java Applet to "fire" an
event that can be handled through scripting on a Web page. This article
shows how to use combination of Java class methods and scripting methods to
simulate events.
MORE INFORMATION
In order to simulate an event from a Java applet, you will need to create a
set of methods in your Java Applet class and a polling function on the Web
page. The polling function will check the applet to see if the event has
occurred and act on that event if it has occurred.
Then, you need to create HTML:
When the Web page is loaded, the window_onLoad function executea. It
sets a "timeout" to execute the checkClicked VBScript function. The
checkClicked function "polls" the Applet by calling the clicked method on
the Applet. If the clicked method returns True, then the checkClicked
displays a message box and resets the timeout. If the clicked method
returned False, then the checkClicked function just resets the timeout.
Both VBScript and JScript can access public members and methods of the Java Applet due to a feature of the Microsoft virtual machine called AutoIDispatch. If you needed to simulate "Event Parameters," such as coordinates of the mouse click, you could add additional public methods on the Applet that returned these values. REFERENCESFor more information about the Microsoft virtual machine's AutoIDispatch feature, please see the following article in the Microsoft Knowledge Base: Q172202 INFO: Implementing Java Automation Objects Using AutoIDispatchFor the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following pages on the Microsoft Technical Support site: http://support.microsoft.com/support/visualj/ Additional query words: fire events applet script
Keywords : kbIE301 kbJScript100 kbJScript200 kbVBScript200 kbIE302 JMisc kbJavaVMFAQ |
Last Reviewed: November 16, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |