Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Problem with <pre> </pre>

Posted on 2006-10-21
6
Medium Priority
?
235 Views
Last Modified: 2010-04-09
I'm trying to use the code below in a web page and want the line to appear as it is below so viewers can see it.

<pre>
document.write('<script src="my_file.js" type=text/javascript></script>');
</pre>

But the output on screen gives me only

document.write('')

What am i doing wrong here?
0
Comment
Question by:dpinto04
  • 4
  • 2
6 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 80 total points
ID: 17782691
dpinto04,

The pre tag does not mean that the browser will ignore special characters.  In fact you may not even need the pre tag if that is why you were using it.  Are you using a server language to write this page?  If so they normally have a function that will automatically change the characters for you.  Otherwise you will need to manually do it.  For example look at the characters and corrections below.

< = &lt;
> = %gt;
"  = %quot;

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17782694
Text in pre tags will usually preserve spaces and line breaks.  The browser will normally show it in a mono-spaced or fixed-pitch font so it will appear different from the rest.
0
 

Author Comment

by:dpinto04
ID: 17782709
If &quot = " whats it for '
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17782731
' is &apos; for apostrophe.  Another very common on is & = &amp; for ampersand.
0
 

Author Comment

by:dpinto04
ID: 17782754
Thanks. Alls working fine now :-)
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17789418
Your welcome!  I'm glad that I could help.  Thank you for the grade, the points and the fun question.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
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

810 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