Click to See Complete Forum and Search --> : onClick to change image in a table


LoneSculler
03-13-2003, 03:39 AM
I'm trying to introduce an image into a table when an end-user clicks a button in a different part of the screen. I understand naming DIVs but am wondering whether I can do this in Javascript?

Any thoughts appreciated!

khalidali63
03-13-2003, 05:34 AM
yes you can do that,there may be multiple ways you can adopt.
Here is one way of doing this

<td onclick="showImage('imageFile.gif',this)">

and in showImage

function showImage(imgzSrc,obj){
obj.innerHTML = "<img src='"+imgSrc+"'>"

}

Cheers

Khalid