Combine HTML tags with a DOM text node element?

Discussion in 'Javascript' started by Robert Oschler, Aug 29, 2005.

  1. 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.
    Robert Oschler, Aug 29, 2005
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Aug 29, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,448
  2. Replies:
    0
    Views:
    372
  3. Tjerk Wolterink
    Replies:
    2
    Views:
    1,423
    Dimitre Novatchev
    Aug 24, 2006
  4. HANM
    Replies:
    2
    Views:
    709
    Joseph Kesselman
    Jan 29, 2008
  5. Robert Oschler

    Fast way to find a text node element in DOM tree?

    Robert Oschler, Aug 29, 2005, in forum: Javascript
    Replies:
    3
    Views:
    133
    Martin Honnen
    Aug 29, 2005
Loading...

Share This Page