Click to See Complete Forum and Search --> : lack of an object


Joy
07-04-2003, 10:27 AM
I need refer to an object that I actually don't exactly have.
That means, I have a bunch of images, each has a name, so they are all proper objects i can erfer to. But i also have some other images that are set in the background of table cells and i need to refer to them as well. all the tries till now didn't work. Can someone be so kind to indicate me a light in the end of this tunnel? please please :)
Thanks a lot for any help you can give me.
Joy

chrismartz
07-04-2003, 10:31 AM
I need refer to an object that I actually don't exactly have

What do you mean by this. and what are you trying to do. Have any code??

Joy
07-04-2003, 10:40 AM
This is the table part:

<tr valign="top">
<td height="15" width="10" valign="top"><img src="images/bcoli.gif" name="bild1" width="10" height="16" border="0"></td>
<td height="15" width="122" align="center" valign="middle" onClick="javascript:setKartei(bild1,this.background,bild2)" background="images/divbco.gif"><font face="verdana" size="1" color="#003399"><b><a href="index.php" name="<?=$name[0]?>" style="text-decoration:none" onMouseOver="this.style.color='#cccccc'" onMouseOut="this.style.color='#ffffff'">HOME</a></b></font></td>
<td height="15" width="10" valign="top"><img src="images/bcoblue.gif" name="bild2" width="10" height="16" border="0"></td>
<td height="15" width="122" align="center" valign="middle" onClick="javascript:setKartei(bild2,this.background,bild3)" background="images/divblue.gif"><font face="verdana" size="1" color="#ffffff"><b><a href="leist.php" name="<?=$name[1]?>" style="text-decoration:none;color:white" onMouseOver="this.style.color='#cccccc'" onMouseOut="this.style.color='#ffffff'">LEISTUNGEN</a></b></font></td>
<td height="15" width="10" valign="top"><img src="images/blueblue.gif" name="bild3" width="10" height="16" border="0"></td>
<td height="15" width="122" align="center" valign="middle" onClick="javascript:setKartei(bild3,this.background,bild4)" background="images/divblue.gif"><font face="verdana" size="1" color="#ffffff"><b><a href="prod.php" name="<?=$name[2]?>" style="text-decoration:none;color:white" onMouseOver="this.style.color='#cccccc'" onMouseOut="this.style.color='#ffffff'">PC-PRODUKTE</a></b></font></td>
<td height="15" width="10" valign="top"><img src="images/blueblue.gif" name="bild4" width="10" height="16" border="0"></td>
<td height="15" width="122" align="center" valign="middle" onClick="javascript:setKartei(bild4,this.background,bild5)" background="images/divblue.gif"><font face="verdana" size="1" color="#ffffff"><b><a href="npc.php" name="<?=$name[3]?>" style="text-decoration:none;color:white" onMouseOver="this.style.color='#cccccc'" onMouseOut="this.style.color='#ffffff'">NPC INTERN</a></b></font></td>
<td height="15" width="10" valign="top"><img src="images/blueblue.gif" name="bild5" width="10" height="16" border="0"></td>
<td height="15" width="122" align="center" valign="middle" onClick="javascript:setKartei(bild5,this.background,bild6)" background="images/divblue.gif"><font face="verdana" size="1" color="#ffffff"><b><a href="kont.php" name="<?=$name[4]?>" style="text-decoration:none;color:white" onMouseOver="this.style.color='#cccccc'" onMouseOut="this.style.color='#ffffff'">KONTAKT</a></b></font></td>
<td height="15" width="10" valign="top"><img src="images/blueblue.gif" name="bild6" width="10" height="16" border="0"></td>
<td height="15" width="122" align="center" valign="middle" onClick="javascript:setKartei(bild6,this.background,bild7)" background="images/divblue.gif"><font face="verdana" size="1" color="#ffffff"><b><a href="imp.php" name="<?=$name[5]?>" style="text-decoration:none;color:white" onMouseOver="this.style.color='#cccccc'" onMouseOut="this.style.color='#ffffff'">IMPRESSUM</a></b></font></td>
<td height="15" width="10" valign="top"><img src="images/blueend.gif" name="bild7" width="10" height="16" border="0"></td>
</tr>

And this is the function I last tried:
function setKartei(name1,name2,name3)
{
if (name1 == "bild1")
{
document[name1].src = "images/bcoli.gif";
document[name2].src = "images/divbco.gif";
document[name3].src = "images/bcoblue.gif";
}
else if (name3 == "bild7")
{
document[name1].src = "images/bluebco.gif";
document[name2].src = "images/divbco.gif";
document[name3].src = "images/blueend.gif";
}
else
{
document[name1].src = "images/bluebco.gif";
document[name2].src = "images/divbco.gif";
document[name3].src = "images/bcoblue.gif";
}
}

As you can see I tried to "fake an object" to solve the problem, using "this.background" in the place of the name of the missing object, although i know it's not a proper way. I had to try but it really doesn't work. I don't know anymore how to acess these pictures that are set in the background. Please help me if you can. Every idea is very welcome. Thanks.

Khalid Ali
07-04-2003, 11:00 AM
you need to use DOM methods the access a particular cell/table and get the reference to it then you can get the background images for those cells...

Joy
07-04-2003, 11:09 AM
thanks dear. :)