Getting Java Applets to talk to JavaScript
Not so long ago I got a couple of e-mails. One asked if I knew how to control an Applet using JavaScript and the other asked me if I knew how to call JavaScript routines from an Applet. At the time I didn't have a clue. However, not being one to turn down a challenge I managed to solve the first problem and this document describes how I solved the second.
Having little experience of Applets I had to ask myself: "CAN it be done?". Well, having looked behind the scenes of the Action Buttons in the R5 View Applets, I discovered they do nothing more than call JavaScript function similar to their HTML counterparts, I knew it could be done. So I set off to find out how...
By way of example here is an Applet that lets you select a colour or add a new one and then, using the "Add" button, pass the value to a JavaScript function in the document. This function then appends the value to the
|