Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to set an applet ID in your html

Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my java script I want to use the following:
var applet = document.getElementById("AppletID");
What do I use in my html <object> tag (where I define the applet embed) to generate an ID that my javascript can use?
Thanks, Jay.
Posts: 15385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there, see you made the trip from the coding forums.
I am not exactly sure what you want, but I will try
you can use the param tag inside of an applet tag
<applet code="Hello.class" width.....blah... id="TheApplet">
<parm name="display" value="This is some text">
You can do the same thing with the object tag
then you should be able to access it with javascript
Javascript is also able to use the public properties and methods and that is what I showed you at the CF. So if you were to set the variable in the public properties you can use the method I showed you.
I am not 100% sure if I answered your question, if not, I will make sure I get the Java Gurus here to help you out!
Jay Schrock
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric, yes I made the switch, lots of really good information in these forums.... Thanks for your help. I was able to add a NAME parm in the object tag, then refer to that in my java script as the ID... Below is an example html tag followed by the java script function that calls a method in the script. Everything works great!! Talk to you later, Jay.
classid = "clsid:CAFEEFAC-0014-0001-0000-ABCDEFFEDCBA"
codebase = ",4,1,0";
WIDTH = 300 HEIGHT = 75 >
<PARAM NAME = CODE VALUE = "HelloWorld.class" >
<PARAM NAME = "type" VALUE = "application/x-java-applet;jpi-version=1.4.1">
<PARAM NAME = "scriptable" VALUE = "false">
type = "application/x-java-applet;jpi-version=1.4.1"
CODE = "HelloWorld.class"
WIDTH = 400 HEIGHT = 400
scriptable = false
pluginspage = "">;
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET> tag!

function changeit(strin) {
var applet = document.getElementById("UBB");
Come have lunch with me Arthur. Adventure will follow. This tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic