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
posted
0
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
posted
0
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(); }