Problem with <pre> </pre>

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?
dpinto04Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
b0lsc0ttConnect With a Mentor IT ManagerCommented:
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
 
b0lsc0ttIT ManagerCommented:
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
 
dpinto04Author Commented:
If &quot = " whats it for '
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
b0lsc0ttIT ManagerCommented:
' is &apos; for apostrophe.  Another very common on is & = &amp; for ampersand.
0
 
dpinto04Author Commented:
Thanks. Alls working fine now :-)
0
 
b0lsc0ttIT ManagerCommented:
Your welcome!  I'm glad that I could help.  Thank you for the grade, the points and the fun question.
0
All Courses

From novice to tech pro — start learning today.