Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing tablecell content programmatically 2

Status
Not open for further replies.

contiw

Programmer
Jun 28, 2002
25
US
Greetings!

A tablecell contains a picture, a link and variables for the onMouseover statemnet, something like this:

<td width=100 align=center>
<img name='img&quot;+i+&quot;' src='./GalleryCover/&quot;+i+&quot;.jpg' height=100 width=100 border=0 onmouseover='overlib(\&quot;&quot;+myArray+&quot;\&quot;)'>
</td>&quot;

I can change the picture programmatically with the .src
attribute, but how can I change the link and the onMouseover variables?

Thanks for helping.
Have a great day.
 
give your td an id (<td id=&quot;aName&quot;>)use the innerHTML property

function changeIT()
{
var obj;
obj=document.getObjectById(&quot;aName&quot;);
obj.innerHTML=&quot;Whatever you want including htmltags&quot;

}
 
Yep! Works great. Thank you very much.
 
contiw,

The best thank you here is a star. It also helps others see when someone had a good answer to something at a glance. That way people can save valuable time and go to where they think they can learn.

On a side note replace :

obj=document.getObjectById(&quot;aName&quot;);

with :

obj = document.getElementById(&quot;aName&quot;);

getobjectById is a plague because it isn't part of any standards I know of (somebody tell me if I am wrong). Gary Haran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top