[thelist] adding HTML using the DOM

Tom Dell'Aringa pixelmech at yahoo.com
Mon Sep 16 12:56:00 CDT 2002


I'm appending a new row to a table using the DOM method. What I need
in one cell is to add a checkbox, so I need to add some HTML. I can
of course add text by using:

textVal = "string of text"
textNode = docTarget.createTextNode(textVal)
cell.appendChild(textNode)

But if I try to put HTML in textVal, it merely writes it out as text.
My second thought was to set an id for the cell:

cell.setAttribute("id","test55")

then use innerHTML to do it like:

document.getElementById('test55').innerHTML = "phooie";

Yet it tells me this is not a valid object. Either you can't set the
id as an attribute, or I'm doing something wrong here. Anyone have
any other ideas how to add the checkbox using the DOM?

Thanks

Tom


=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com



More information about the thelist mailing list