?
Solved

Code view

Posted on 2013-06-04
5
Medium Priority
?
220 Views
Last Modified: 2013-06-27
I'm trying to figure a way of showing CSS / HTML and javascript code in a page,  I've managed to get the html code to show how I want but want to put it in a scrolling windows.

I thought I could try and use an iFrame, but its a bit of a mess making another page to pull the html in, eg:-
<iframe src="mycode.php"></iframe> 

Open in new window


What I would have preferred to use is:-
<iframe><strong>Hello</strong><I>Test</I></iframe> 

Open in new window


However it doesn't show the html inside.

I read an article that used a textArea to put html code inside, but using the code just puts the raw html in (without highlighting):-
<textarea><strong>Hello</strong><I>Test</I></textarea>

Open in new window


Experts-exchange seem to be able to do it (without highlighting).

How does everyone else do it?
0
Comment
Question by:tonelm54
5 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 39220234
Replace the open and close brackets with &gt; and &lt;.  This will allow you to display the markup but not cause the browser to interpret it as HTML.
0
 

Author Comment

by:tonelm54
ID: 39220240
As a textarea or iframe?
0
 
LVL 23

Accepted Solution

by:
tailoreddigital earned 2000 total points
ID: 39220243
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 39220274
I'm sorry, I misunderstood the question.  [tailoreddigital]'s <code> tag may be the way to go.
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 39220304
You can also just convert non alpha numeric's to entities http://www.webmaster-toolkit.com/html-entity-chart.shtml

Then place all of that in a div with a height class set to overflow scroll.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question