469,271 Members | 1,776 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Combine HTML tags with a DOM text node element?

I have several text nodes that I create on the fly in my web page use
document.createTextNode().

Is there an easy way using DOM techniques to add formatting tags like <b>,
<H2>, etc. to my text node, without having to create extra nodes for every
little detail? Is there a better technique?

Thanks.
Aug 29 '05 #1
1 1358


Robert Oschler wrote:
Is there an easy way using DOM techniques to add formatting tags like <b>,
<H2>, etc. to my text node, without having to create extra nodes for every
little detail? Is there a better technique?


If you are scripting HTML documents then most browsers around now
support the innerHTML property of elements to be set to a snippet of
HTML markup which the browser then parses and inserts as the content of
the element.
innerHTML is not a W3C DOM property but IE 4 introduced it and now
Mozilla, Opera, Safari, Konqueror do too.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 29 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Anders Eriksson | last post: by
4 posts views Thread by Mike Conmackie | last post: by
4 posts views Thread by Mike Kamermans | last post: by
5 posts views Thread by Jim Bancroft | last post: by
5 posts views Thread by kmunderwood | last post: by
2 posts views Thread by Raja Kannan | last post: by
9 posts views Thread by Patient Guy | last post: by
82 posts views Thread by Eric Lindsay | last post: by
2 posts views Thread by taras.di | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.