Click to See Complete Forum and Search --> : Help-a-newbie : Changing Table Cell Content


w_conti
03-12-2003, 10:59 AM
Greetings!

A table cell contains a picture, a link and an onMouseover,
something like this :

<td>
<a href="javascript:void(0)"><img name='img"+i+"' src='./GalleryCover/"+i+".jpg' height=100 width=100 border=0 onmouseover='overlib(\""+myArray[i]+"\")'></a>
</td>

I can change the picture programmatically with the .src attributes, but how can I change the link and the variable of the onMouseover?

Thanks for helping

Nevermore
03-12-2003, 01:23 PM
To change the text and target of a link, use this code:

document.getElementById(your_id).firstChild.innerHTML="<a href="url_here">Text Here</a>

w_conti
03-12-2003, 01:40 PM
Thank you Cijori

"your_id" is the tablecell id, isn't it?

Nevermore
03-12-2003, 01:42 PM
Everything surrounded by the id will be changed, so you might want to make it the link ID