View Full Version : Java Script and controlling aplet to load images dynamicly

04-29-2008, 01:29 PM
Dear all

I have an applet in my web page that is something like this:

<applet archive="myapplet.zip" id="myapplet" code="myapplet.class" width="252" height="147" codebase="mybase">
<param name="rooms.length" value="3">
<param name="startroom" value="0">
<param name="actions.length" value="3">

<param name="rooms[0]" value="CylinderRoom">
<param name="rooms[0].hotspotFG" value="black">
<param name="rooms[0].hotspotBG" value="yellow">
<param name="rooms[0].initPos.yaw" value="200">
<param name="rooms[0].image" value="imageRoom1.jpg">

This is pretty much one of those panoramic viewers that i bought of the shelf a while ago.

The room is the actual panoramic that i would like to view in the applet.

But i have close to 500 of those images. IT would be a bit nonsense to create 500 of those room parameters.

I know the image name of the image i would like to load. Is it possible to do a bit of trickery to that with some javascript?

Pretty much all i would like to do is have the dynamic loading of images.All the other parameters can be same.

Any advice would be apreciated...


04-29-2008, 02:09 PM
You can do that with Javascript.
you can have a loop that creates those param tags and inserts the information like this:

for i=0;i<500;i++)
param = document.createElement("PARAM");
param.value = "paramValue";
param.name = rooms[0];

This would create one param tag and would insert it to the body tag. If you want more tags you can repeat these lines.