Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print html to the screen on your web page

Status
Not open for further replies.

bhogaj31

IS-IT--Management
Mar 11, 2003
114
0
0
GB
Hi,

I am having trouble trying to print some of my html code to the screen. I am trying to print an example of html code to the screen, so a visitor can actually see a line of html.

What tag do I have to put my text into to display the html code to the screen?

I just want to do this in basic html.

Any help much appreciated

Bhogaj31
 
You have to replace all your < with &lt; and all your > with &gt;

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
either that, or place it in a textarea so it doesnt get interpreted by the browser.
Code:
<textarea>some html here</textarea>

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Never use BLOCKQUOTE for this purpose: browser renders text inside BLOCKQUOTE. You want to print </BODY> tag - what do you suppose this means?..

The only way to print HTML code on HTML page: see kaht's post above. Strictly speaking, you must replace quotes and ampersands too (&quot; and &amp; respectively)...
 
Thanks guys, that is great.

I saw the &lt; and &gt; references somewhere before but couldn't work out if they were just for showing code or something else. I will do some more reading.

Bhogaj31

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top