View Full Version : table
looloo
10-16-2002, 12:19 AM
:rolleyes: can somebody help me?
i would like to know wich javascript i should use in order
to change picture in one td by pressing on a botton in another td
i'll appreciate your help :thumbsup:
chrismiceli
10-16-2002, 01:12 AM
do this
function hi() {
document.images["myImg"].src="backgd2.jpg"
}
<table name="tablename">
<tr>
<td><input type="button" onClick="hi()" value="test"><tr>
<td><img src="test.jpg" name="myImg"></td>
</table>
<edit> glen you were right, i just slipped up, didn't think, thanx.
try that:D
brass fish
10-16-2002, 01:39 AM
i dont think u need 2 put the table name in there :)
glenngv
10-16-2002, 06:56 AM
chrismiceli, did you try youre code before you post it? I don't think it will ever work.
looloo, what do you mean image in the td? background or just image inside the td?
if background:
<td id="myTD" style="background-image:url('backgd.jpg')">blah</td>
<td><input type="button" value="Change image" onclick="document.getElementById('myTD').style.backgroundImage='url(\"backgd2.jpg\")'"></td>
if image inside the td:
<td><img name="myImg" src="backgd.jpg"></td>
<td><input type="button" value="Change image" onclick="document.images['myImg'].src='backgd2.jpg'"></td>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.