So, I've just encountered something I've never seen before. This is what I did... kind of. document.write('<textarea>'); document.write('...in here goes a whole bunch of html that I don't want to be formatted'); document.write('</textarea>'); Code (markup): But the problem is, the html contains '</textarea>' so it just ends the area, and the rest of the html is parsed and displayed in the browser (formatted). Assume I can't edit the html, cause it needs to be displayed exactly as it is. How can I put all this html into the textarea and have it be unformatted, and not prematurely end the textarea?? Thanks in advance.
Hey, it seems to work for me, this is the code I used. <script> document.write('<textarea>'); document.write('<BR><TEST><img src="a.gif">'); document.write('</textarea>');</script> Code (markup):
var myTextVar = 'blah blah blah <textarea> <html> whatever I want'; var ta = document.createElement('textarea'); ta.appendChild(document.createTextNode(myTextVar)); document.body.appendChild(ta); PHP: The trick is using createTextNode. It will not parse any html.