my dog learned polymorphism
The moose likes Applets and the fly likes Using applet to write to HTML page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Using applet to write to HTML page" Watch "Using applet to write to HTML page" New topic

Using applet to write to HTML page

Ali Kiyani

Joined: Sep 15, 2005
Posts: 7

How do I write to a HTML page using applet? Let's say I want to print "Hello World" through applet which will be displayed inside a <div> tag in HTML, how do I do that?

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

You do it with Javascript.

You'll have to put suitable Javascript code in the page which allows that to happen, then you can have the applet call Javascript functions. I haven't done that myself but it's certainly possible.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Actually, Javascript is not required. The page DOM can be manipulated via the Common DOM API. The AppletsFaq links to an article about that.
I agree. Here's the link:
subject: Using applet to write to HTML page
It's not a secret anymore!