| View previous topic :: View next topic |
| Author |
Message |
kadamat
Joined: 01 Jun 2006 Posts: 88
|
| How do I make '<p>' str to be evaluated as html tag ? |
| |
|
|
|
|
Peter Pitt
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
| document.createElement('p') |
| |
|
|
kadamat
Joined: 01 Jun 2006 Posts: 88
|
i do:
Var txt = document.createTextNode(str);
Comments.appendChild(txt); |
| |
|
|
Peter Pitt
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
| that's a textnode, I meant document.createElement() |
| |
|
|
kadamat
Joined: 01 Jun 2006 Posts: 88
|
Should I create all markup as elements ?
My 'str' lookadamat like '<p> aaa <b>mmm</b>' |
| |
|
|
Peter Pitt
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
then instead, use .innerHTML
Comments.innerHTML=str; |
| |
|
|
kadamat
Joined: 01 Jun 2006 Posts: 88
|
| that's not working for me in IE |
| |
|
|
Peter Pitt
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
It should
Depending on what 'comments' may be |
| |
|
|
kadamat
Joined: 01 Jun 2006 Posts: 88
|
| It's <div> |
| |
|
|
Roombor
Joined: 02 Jun 2006 Posts: 111
|
| You should indeed create all markup as elements. The DOM is the way forward. :) |
| |
|
|
| Page 1 of 2 |
Goto page 1, 2 Next |
|