<span>

liunx

Guest
Hi all,<br />
<br />
Is there a way to position multiple <span>'s inside a <td> so that they are stacked on top of one another without using absolute positioning as the table may not always be in the same place.<br />
<br />
<table><br />
<tr><br />
<td><br />
<span id="img1" valign="top" align="center" style="WIDTH: 410; HEIGHT: 382; VISIBILITY: show;"><img border="0" src=http://www.htmlforums.com/archive/index.php/"images/img_1.jpg" width="510" height="382"></span><br />
<br />
<span id="img2" valign="top" align="center" style="WIDTH: 410; HEIGHT: 382; VISIBILITY: hidden;"><img border="0" src=http://www.htmlforums.com/archive/index.php/"images/img_2.jpg" width="510" height="382"></span><br />
</td><br />
</tr><br />
</table><br />
<br />
Thanks in advance!<br />
HedgeHog<!--content-->All you want here is an Image rollover.<br />
Just put an image inside your <td> and change its .src property when need be. Do a web search on image rollover for examples.<br />
<br />
And to answer your question, No - you need absolute positioning.<!--content-->Ok, I found and modified a image rollover script and got it to work fine except.....I need the image names to come into the javascript below as variables ($img_1, $img_2, $img_3, $img_4, $img_5).<br />
<br />
I did check to see if the variables are present and they are, but how do I get them to load into the following part of the script?<br />
<br />
echo "photos[0]=\"$img_1\";\n";<br />
echo "photos[1]=\"$img_2\";\n";<br />
echo "photos[2]=\"$img_3\";\n";<br />
echo "photos[3]=\"$img_4\";\n";<br />
echo "photos[4]=\"$img_5\";\n";<br />
<br />
<br />
<br />
echo "<script language=\"JavaScript1.2\">\n";<br />
echo "var photos=new Array()\n";<br />
<br />
echo "photos[0]=\"$img_1\";\n";<br />
echo "photos[1]=\"$img_2\";\n";<br />
echo "photos[2]=\"$img_3\";\n";<br />
echo "photos[3]=\"$img_4\";\n";<br />
echo "photos[4]=\"$img_5\";\n";<br />
<br />
echo "function img0(){\n";<br />
echo "window.status=''\n";<br />
echo "imgnum=0\n";<br />
echo "document.images.imgchanger.src=http://www.htmlforums.com/archive/index.php/photos[imgnum]\n";<br />
echo "}\n";<br />
<br />
echo "function img1(){\n";<br />
echo "window.status=''\n";<br />
echo "imgnum=1\n";<br />
echo "document.images.imgchanger.src=http://www.htmlforums.com/archive/index.php/photos[imgnum]\n";<br />
echo "}\n";<br />
<br />
echo "function img2(){\n";<br />
echo "window.status=''\n";<br />
echo "imgnum=2\n";<br />
echo "document.images.imgchanger.src=http://www.htmlforums.com/archive/index.php/photos[imgnum]\n";<br />
echo "}\n";<br />
<br />
echo "function img3(){\n";<br />
echo "window.status=''\n";<br />
echo "imgnum=3\n";<br />
echo "document.images.imgchanger.src=http://www.htmlforums.com/archive/index.php/photos[imgnum]\n";<br />
echo "}\n";<br />
<br />
echo "function img4(){\n";<br />
echo "window.status=''\n";<br />
echo "imgnum=4\n";<br />
echo "document.images.imgchanger.src=http://www.htmlforums.com/archive/index.php/photos[imgnum]\n";<br />
echo "}\n";<br />
<br />
echo "</script>\n";<!--content-->Well, I don't know why you'd want so many functions doing the same thing. Why not try:<br />
<br />
echo "function img(n){\n";<br />
echo "window.status=''\n";<br />
echo "document.images.imgchanger.src=http://www.htmlforums.com/archive/index.php/photos[n]\n";<br />
echo "}\n";<br />
<br />
// Then you'd call it by: img(4)<br />
<br />
<br />
Can't help you with the php I'm afraid. Scoutt's our resident php guru. If he doesn't see this then you might like to pm him.<!--content-->Hey thanks,<br />
<br />
I will give it a try. I also posted this over at server side and got some resolutions over there.<br />
<br />
Thanks again<!--content-->
 
Back
Top