Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Problem with <pre> </pre>

Posted on 2006-10-21
6
212 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 20 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

809 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