View Full Version : Another Question for the Pros :P

07-29-2005, 04:26 AM
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:

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:

<script type="text/javascript">
var legendvalue
document.write('<table border="1" cellspacing="0" cellpadding="0"><tr>');
//make table rows
if(i==21 || i==41 || i==61 || i==81 || i==101 || i==121|| i==141 || i==161 || i==181 || i==201){
//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>');
function setup(thevalue){
legendvalue = thevalue;
<table cellpadding="0" cellspacing="0" border="1">
<img src="concrete.jpg" onclick="setup(1)">
<img src="block.bmp" onclick="setup(2)">


07-29-2005, 05:52 AM
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.

07-29-2005, 05:54 PM
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.