Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q4059 How do I pass a variables value from an Applet to HTML and vice versa?

irt.org | Knowledge Base | Java | Q4059 [ previous next ]

Q4059 How do I pass a variables value from an Applet to HTML and vice versa?

All you can do is you can access the public variable of an applet which is downloaded. Using JavaScript you can access the public variable of the Java applet:

public class xyz extends java.applet.Applet
{
  public int x = 10 ;
  public void init()
  {
  }
} // End of applet code 

Inside the HTML page you can have JavaScript code to access the value of x:

<script language = "JavaScript">
alert(document.xyz.x);
</script>

<applet name="xyz" code="xyz.class" width=100 height=100>
</applet>

Feedback on 'Q4059 How do I pass a variables value from an Applet to HTML and vice versa?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.