aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes How to set an applet ID in your html Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "How to set an applet ID in your html" Watch "How to set an applet ID in your html" New topic
Author

How to set an applet ID in your html

Jay Schrock
Greenhorn

Joined: Apr 27, 2003
Posts: 12
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.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
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">
</applet>
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.
Eric
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
Greenhorn

Joined: Apr 27, 2003
Posts: 12
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.
<OBJECT
NAME = "UBB"
classid = "clsid:CAFEEFAC-0014-0001-0000-ABCDEFFEDCBA"
codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1-windows-i586.cab#Version=1,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">
<COMMENT>
<EMBED
type = "application/x-java-applet;jpi-version=1.4.1"
CODE = "HelloWorld.class"
WIDTH = 400 HEIGHT = 400
scriptable = false
pluginspage = "http://java.sun.com/products/plugin/index.html#download">
<NOEMBED>
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET> tag!
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>

function changeit(strin) {
var applet = document.getElementById("UBB");
applet.change(strin);
applet.repaint();
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set an applet ID in your html
 
Similar Threads
How to embed Applet into the Browser?
Parameters in HTML/Applet
Applet-Servlet communications - help
htm, javascript & jsp together???
Applet-Servlet Communication - problem