Results 1 to 3 of 3

Thread: Another Question for the Pros :P

  1. #1
    Join Date
    Jul 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Another Question for the Pros :P

    Yeah I'm making a map creator where you can make a map for my linear array visually. basiclly you click on the legend then you click on td you want the tile in and eventually I will make it so you click generate and bam it gives you an array. I diverge from my point here's the script in action:
    http://www.cyberpunkgame.0nyx.com/map.html

    Yeah and the problem is since I can't create the images on-the-fly that're in a table I figured I'd have to use z-index to stack them. but position absolute puts them absolutely outta the table. I dunno here's the code:
    HTML Code:
    <html>
    <head>
    <script type="text/javascript">
    <!--
    var legendvalue
    //across
    document.write('<table border="1" cellspacing="0" cellpadding="0"><tr>');
    //make table rows
    for(i=1;i<201;i++){
    if(i==21 || i==41 || i==61 || i==81 || i==101 || i==121|| i==141 || i==161 || i==181 || i==201){
    document.write('</tr><tr>');
    }
    //create td's 200 to be exact
    document.write('<td height="25" width="25" ><img id="concrete'+ i +'" src="concrete.jpg" style="position:absolute;z-index:1"><img id="block'+ i +'" src="block.bmp" style="position:absolute;z-index:2"></td>');
    }
    document.write('</table>');
    function setup(thevalue){
    legendvalue = thevalue;
    }
    //-->
    </script>
    </head>
    <body>
    <table cellpadding="0" cellspacing="0" border="1">
    <tr>
    <td>
    ..::Legend::..
    </td>
    </tr>
    <tr>
    <td>
    <img src="concrete.jpg" onclick="setup(1)">
    <img src="block.bmp" onclick="setup(2)">
    </td>
    
    </tr>
    </table>
    </body>
    </html>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I tried out your code, I really don't see the point, yet. Anyways, you can also use position relative in order to be able to set z-index for an element. And, since I see you are using a table, in order to have one image behind the other you could, instead of worring about z-index, set it to the background of the table or the table cell(s). The image assigned to the background and foreground can be swapped (if need be) with javascript at times appropriate for whatever it is you are trying to do.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok that's a good solution but I'm having more tiles and jscheuer the code isn't finoshed that's why it should do pretty much nothing. I just wanted the out of table problem fixed before I continued.

Bookmarks

Posting Permissions

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