[thelist] innerHTML and DOM [solved]

Tom Dell'Aringa pixelmech at yahoo.com
Mon Sep 16 13:32:01 CDT 2002


--- ".jeff" <jeff at members.evolt.org> wrote:
> tom,
>
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > From: Tom Dell'Aringa
> >
> > ahh..if I had only tried this first. For those
> > interested:
> >
> > cell.innerHTML = "<input type=\"checkbox\" id=\"box1\"
> > /><label for=\"box1\">checkbox</label>";
> > row.appendChild(cell)
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
> or, you could have simply created a checkbox and label elements and
> appended them to the cell which you then appended to the row (not
> tested).
>
> checkbox = document.createElement('INPUT');
> checkbox.type = 'checkbox';
> checkbox.id = 'box1';
> label = document.createElement('LABEL');
> label.htmlFor = 'box1';
> label.innerText = 'checkbox';
> cell.appendChild(checkbox);
> cell.appendChild(label);
> row.appendChild(cell);

I would think that would work. Maybe more lines - would that be NN6
compatible too..i would think it would.

> fwiw, using innerHTML is the very reason why i've stopped using
> double-quotes as string qualifies in javascript.  i get tired of
> having to escape all the double-quotes around attribute values.
> so, i just use single-quotes instead.  saves me time, is easier to
> debug, and much easier to read.

Yes, I remember you pointing this out before, and I was doing that.
Its a good idea.

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