24 October 2005

Numeric Entities

In my previous post, I couldn't show the actual HTML codes because they confused the Blogger form. I had to use double open parenthesis ( (( ) to represent open angle bracket ( < ) and so on to show the "codes". It was a pretty lame solution and bothered me so much I dug into my ancient Teach Yourself Web Publishing With HTML 3.2 to find a better solution. I thought there should be some tags that would tell the browser to ignore everything below. I used the remark tag <!-- and --> but then the whole thing would be hidden. I would have to add a note telling my visitors to view the source code to copy it. Not nice.

In the end, the answer is to use numeric entities to represents characters that would normally be interpreted as markup language. < is represented as &#60, > by &#62, and so on. Enjoy!





From:


<html>
<body marginwidth=2 ...>
<palettedim cx=266 cy=330 >
<img src="animgif01" alt="" onmouseover="window.event.srcElement.style.cursor='hand'"/>
<img src="animgif02" ...
<img src="animgif03" ...
...
</body>
</html>


To:


<html>
<style type="text/css">
div
{
width:266;
height:330;
overflow:auto
}
</style>
<body marginwidth=2 ...>
<div>
<palettedim cx=266 cy=330 >
<img src="animgif01" alt="" onmouseover="window.event.srcElement.style.cursor='hand'"/>
<img src="animgif02" ...
<img src="animgif03" ...
...
</div>
</body>
</html>

No comments:

Post a Comment