This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • 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");
    Bookmark Topic Watch Topic
  • New Topic