This section provides a tutorial example on how to use HTML entities < and > to protext HTML tags
To completely resolve the problem we saw in the previous section,
we need to use HTML entities to replace '<' and '>',
if you want some HTML tags to be displayed as page content.
Here is the revised HTML document using < and > entities:
<html>
<!-- Escape_Script_Tag_HTML_Entity.html
Copyright (c) 2008 by Dr. Herong Yang, http://www.herongyang.com/
-->
<head><title>Escaping Script Tags</title></head>
<body><pre>
<script type="text/javascript">
document.writeln("Q: How to use the <script> tag?");
document.writeln("A: <script>...Code...<\/script>");
document.writeln("Rate this answer: 1 | 2 | 3 | 4 | 5");
</script>
</pre></body>
</html>
If you run this example script in a browser, you will get:
Q: How to use the <script> tag?
A: <script>...Code...</script>
Rate this answer: 1 | 2 | 3 | 4 | 5