File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to write a tag html  as a string with javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to write a tag html  as a string with javascript?" Watch "How to write a tag html  as a string with javascript?" New topic
Author

How to write a tag html as a string with javascript?

Giulietta Blumarine
Ranch Hand

Joined: Dec 03, 2004
Posts: 59
Hi!
I want to write for example the folling string "<B><////></table>" with "document.write" of javascript without browser reads it as a tag html .....
I want to read the tag on the screen!!!

Can somebody help me?

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
escape the characters.

replace < with &lt; and > with &gt;

Eric
Giulietta Blumarine
Ranch Hand

Joined: Dec 03, 2004
Posts: 59
Thank you very much!
I have replace the text I have to write in this way:

temp = temp.replace(/>/g,">");
temp = temp.replace(/</g,"<");

Giu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to write a tag html as a string with javascript?
 
Similar Threads
Funny innerHTML behavior
Setting dynamic parameter values?
Restricting user to upload a CSV file
setting value for hidden tag
HTML Chars escape