473,508 Members | 3,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic insertion of applet


I need to dynamically insert the following applet code in my document:
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 0
HEIGHT = 0 NAME = "myApplet"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3">
<PARAM NAME = CODE VALUE = "FooApplet.class" >
<PARAM NAME = CODEBASE VALUE = "http://foo.com/java/" >
<PARAM NAME = ARCHIVE VALUE = foo.jar" >
<PARAM NAME = NAME VALUE = "fooApplet" >
<PARAM NAME = MAYSCRIPT VALUE = true >
<PARAM NAME = "type" VALUE =
"application/x-java-applet;jpi-version=1.3.1_03">
<PARAM NAME = "scriptable" VALUE = "true">

<COMMENT>
</COMMENT>
</OBJECT>
The code above works fine in IE6/XP. For dyn. insertion, I try the
code below, but it does not load the applet properly. Any ideas?
<SCRIPT language="JavaScript">

var obj = document.createElement("object");
obj.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
obj.setAttribute("width", "0");
obj.setAttribute("height", "0");
obj.setAttribute("name", "myApplet");
obj.setAttribute("id", "myApplet");
obj.setAttribute("codebase",
"http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3");

var p1 = document.createElement("param");
p1.setAttribute("name", "code");
p1.setAttribute("value", "FooApplet.class");
obj.appendChild(p1);

var p2 = document.createElement("param");
p2.setAttribute("name", "codebase");
p2.setAttribute("value", "http://foo.com/java/");
obj.appendChild(p2);

var p3 = document.createElement("param");
p3.setAttribute("name", "archive");
p3.setAttribute("value", "foo.jar");
obj.appendChild(p3);

var p4 = document.createElement("param");
p4.setAttribute("name", "name");
p4.setAttribute("value", "fooApplet");
obj.appendChild(p4);

var p5 = document.createElement("param");
p5.setAttribute("name", "mayscript");
p4.setAttribute("value", "true");
obj.appendChild(p5);

var p6 = document.createElement("param");
p6.setAttribute("name", "scriptable");
p4.setAttribute("value", "true");
obj.appendChild(p6);

var p7 = document.createElement("param");
p7.setAttribute("name", "type");
p4.setAttribute("value",
"application/x-java-applet;jpi-version=1.3.1_03");
obj.appendChild(p7);

document.body.appendChild(obj);

</SCRIPT>

Jul 20 '05 #1
3 13394
Try to use simple document.writeln's as follows:

<SCRIPT language=JavaScript>
document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"');
document.writeln('WIDTH = 0 HEIGHT = 0 NAME = "myApplet"');
document.writeln(...
document.writeln('</OBJECT>');
</SCRIPT>

I hope this helps.

Wagner

Tormod Omholt-Jensen <to*@pvv.org> wrote in message news:<Pi*******************************@verden.pvv .ntnu.no>...
I need to dynamically insert the following applet code in my document:
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 0
HEIGHT = 0 NAME = "myApplet"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3">
<PARAM NAME = CODE VALUE = "FooApplet.class" >
<PARAM NAME = CODEBASE VALUE = "http://foo.com/java/" >
<PARAM NAME = ARCHIVE VALUE = foo.jar" >
<PARAM NAME = NAME VALUE = "fooApplet" >
<PARAM NAME = MAYSCRIPT VALUE = true >
<PARAM NAME = "type" VALUE =
"application/x-java-applet;jpi-version=1.3.1_03">
<PARAM NAME = "scriptable" VALUE = "true">

<COMMENT>
</COMMENT>
</OBJECT>
The code above works fine in IE6/XP. For dyn. insertion, I try the
code below, but it does not load the applet properly. Any ideas?
<SCRIPT language="JavaScript">

var obj = document.createElement("object");
obj.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
obj.setAttribute("width", "0");
obj.setAttribute("height", "0");
obj.setAttribute("name", "myApplet");
obj.setAttribute("id", "myApplet");
obj.setAttribute("codebase",
"http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3");

var p1 = document.createElement("param");
p1.setAttribute("name", "code");
p1.setAttribute("value", "FooApplet.class");
obj.appendChild(p1);

var p2 = document.createElement("param");
p2.setAttribute("name", "codebase");
p2.setAttribute("value", "http://foo.com/java/");
obj.appendChild(p2);

var p3 = document.createElement("param");
p3.setAttribute("name", "archive");
p3.setAttribute("value", "foo.jar");
obj.appendChild(p3);

var p4 = document.createElement("param");
p4.setAttribute("name", "name");
p4.setAttribute("value", "fooApplet");
obj.appendChild(p4);

var p5 = document.createElement("param");
p5.setAttribute("name", "mayscript");
p4.setAttribute("value", "true");
obj.appendChild(p5);

var p6 = document.createElement("param");
p6.setAttribute("name", "scriptable");
p4.setAttribute("value", "true");
obj.appendChild(p6);

var p7 = document.createElement("param");
p7.setAttribute("name", "type");
p4.setAttribute("value",
"application/x-java-applet;jpi-version=1.3.1_03");
obj.appendChild(p7);

document.body.appendChild(obj);

</SCRIPT>

Jul 20 '05 #2

Thanks for the suggestion. This works if the script is run before the
onload event is trigged. I need however to insert the applet _after_ the
onload event. Using document.write at this stage clears all the already
displayed content of the browser.

Tormod
On Thu, 2 Oct 2003, W d'Anjos wrote:

|Try to use simple document.writeln's as follows:
|
|<SCRIPT language=JavaScript>
|document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"');
|document.writeln('WIDTH = 0 HEIGHT = 0 NAME = "myApplet"');
|document.writeln(...
|document.writeln('</OBJECT>');
|</SCRIPT>
|
|I hope this helps.
|
|Wagner
|
|Tormod Omholt-Jensen <to*@pvv.org> wrote in message news:<Pi*******************************@verden.pvv .ntnu.no>...
|> I need to dynamically insert the following applet code in my document:
|>
|>
|> <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 0
|> HEIGHT = 0 NAME = "myApplet"
|> codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3">
|> <PARAM NAME = CODE VALUE = "FooApplet.class" >
|> <PARAM NAME = CODEBASE VALUE = "http://foo.com/java/" >
|> <PARAM NAME = ARCHIVE VALUE = foo.jar" >
|> <PARAM NAME = NAME VALUE = "fooApplet" >
|> <PARAM NAME = MAYSCRIPT VALUE = true >
|> <PARAM NAME = "type" VALUE =
|> "application/x-java-applet;jpi-version=1.3.1_03">
|> <PARAM NAME = "scriptable" VALUE = "true">
|>
|> <COMMENT>
|> </COMMENT>
|> </OBJECT>
|>
|>
|> The code above works fine in IE6/XP. For dyn. insertion, I try the
|> code below, but it does not load the applet properly. Any ideas?
|>
|>
|> <SCRIPT language="JavaScript">
|>
|> var obj = document.createElement("object");
|> obj.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
|> obj.setAttribute("width", "0");
|> obj.setAttribute("height", "0");
|> obj.setAttribute("name", "myApplet");
|> obj.setAttribute("id", "myApplet");
|> obj.setAttribute("codebase",
|> "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3");
|>
|> var p1 = document.createElement("param");
|> p1.setAttribute("name", "code");
|> p1.setAttribute("value", "FooApplet.class");
|> obj.appendChild(p1);
|>
|> var p2 = document.createElement("param");
|> p2.setAttribute("name", "codebase");
|> p2.setAttribute("value", "http://foo.com/java/");
|> obj.appendChild(p2);
|>
|> var p3 = document.createElement("param");
|> p3.setAttribute("name", "archive");
|> p3.setAttribute("value", "foo.jar");
|> obj.appendChild(p3);
|>
|> var p4 = document.createElement("param");
|> p4.setAttribute("name", "name");
|> p4.setAttribute("value", "fooApplet");
|> obj.appendChild(p4);
|>
|> var p5 = document.createElement("param");
|> p5.setAttribute("name", "mayscript");
|> p4.setAttribute("value", "true");
|> obj.appendChild(p5);
|>
|> var p6 = document.createElement("param");
|> p6.setAttribute("name", "scriptable");
|> p4.setAttribute("value", "true");
|> obj.appendChild(p6);
|>
|> var p7 = document.createElement("param");
|> p7.setAttribute("name", "type");
|> p4.setAttribute("value",
|> "application/x-java-applet;jpi-version=1.3.1_03");
|> obj.appendChild(p7);
|>
|> document.body.appendChild(obj);
|>
|> </SCRIPT>
|
Jul 20 '05 #3
Tormod Omholt-Jensen <to*@pvv.org> writes:
Using document.write at this stage clears all the already displayed
content of the browser.
Yep.
Please trim your quotes instead of including the enitre message you
reply to (and it doesn't help that the one you reply to did the same).

Anyway: |> var p5 = document.createElement("param");
|> p5.setAttribute("name", "mayscript");
|> p4.setAttribute("value", "true");


Shouldn't this be two times "p5.setAttribut". Ditto for the two next
params.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9506
by: nathanlaan | last post by:
This is the stupidest thing I have ever seen. Java 1.2, 1.3, and 1.4.1, and 1.4.2 all define the Applet.getDocumentBase() method differently! How am I supposed to get the directory of the document...
0
9857
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
1
2932
by: Charlie Kim | last post by:
Here is gnome applet source of mine. -------------------------------------------------- #!/usr/bin/env python import pydic import gtk import gnome.applet
20
3834
by: Patrick Guio | last post by:
Dear all, I have some problem with insertion operator together with namespace. I have a header file foo.h containing declaration of classes, typedefs and insertion operators for the typedefs in...
0
5648
by: ankur | last post by:
WHEN I RUN THIS WEB APPLICATION ON Tomcat5.5.9 SERVER MY HttpChatApplet sccessfully Loaded from ChatDispatch but running on some another PC HttpChatApplet not loaded my Coad ...
5
2080
by: barbaros | last post by:
Hello everybody, I need to put some dynamic drawings on my web page. More precisely, I need to draw a number of geometric figures (circles, rectangles) which evolve into a graphics windows...
28
3380
by: Peter Michaux | last post by:
Hi, I'm playing with dynamic script insertion to make a request to the server for a JavaScript file to be automatically run when it arrives in the browser. It works but... The page caching...
4
7793
by: tudyfruity18 | last post by:
I'm suppose to write an applet that contains two buttons Investment calculator and Loan Calculator. When the Investment Calculator button is clicked, a frame appears in a new window for calculating...
3
5689
by: aj | last post by:
DB2 LUW 8.1 fixpak 14 Red Hat EL AS 4.4 I'm trying to diagnose some nocturnal CPU pressure, and am trying to understand the dynamic statement cache as it applies to LUW. The only doc/redbooks...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.