Click to See Complete Forum and Search --> : Easy Question


wfsaxton
02-16-2003, 06:32 PM
I want a page, upon initialization, to print some text, say in a table. When a user clicks a link, I want an image to replace the text. I don't see anything in the DOM that would allow this to happen, though I'm sure a solution exists.

Thanks in advance.

khalidali63
02-16-2003, 06:40 PM
Originally posted by wfsaxton
I don't see anything in the DOM that would allow this to happen.

You did not look hard..
:p

give the table cell an id attribute ,thenaccess this cell using

document.getElementById("idName")

and use innerHTML property

document.getElementById("idName").innerHTML = "<img src='pic.gif' >";

the above should put a pic in the cell

cheers

Khalid

wfsaxton
02-16-2003, 07:32 PM
I KNEW there had to be a way to access table elements in the DOM. You're right, I didn't look hard enough :)

Thanks.