javajavascriptdomappletliveconnect

Java applet DOM manipulation example?


I am looking to write my first Java applet (with a difference). I want to write an applet that manipulates the DOM of the page in which the applet is placed. A suitable example would show how:

  1. an element can be retrieved from the DOM (by name, id or some other CSS property)
  2. Insertion/deletion of an element in to the DOM (before/after) a given DOM element
  3. the innerHTML of a DOM element can be changed

  4. Call a javascript function and pass data from the Java applet, to the javascript function

I have searched the internet - but so far, have not come accross any such example. Is anyone aware of such an example?. If yes, please post a link, or a snippet that shows how to achieve the functionality listed above, if possible.


Solution

  • www.java2s.com is alsways a good starting point to look for examples.

    http://www.java2s.com/Code/JavaScript/Development/UsingJavaScriptinanApplet.htm