Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Java Script and controlling aplet to load images dynamicly

    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...


    Cheers
    DAn

  • #2
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    You can do that with Javascript.
    you can have a loop that creates those param tags and inserts the information like this:
    Code:
    for i=0;i<500;i++)
    {
    param = document.createElement("PARAM");
    param.value = "paramValue";
    param.name = rooms[0];
    document.getElementsByTagName("BODY")[0].appendChild(param);
    }
    This would create one param tag and would insert it to the body tag. If you want more tags you can repeat these lines.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •