Thursday, August 18, 2011

Display HTML, Javascript and CSS in Blog

When we try to display some html, javascript and css code in our Blog, in stead of being treated as plain text, they are often rendered as a part of the blog code. The trick to display them is translating the tags into their aliases. For example, use &lt; for '<' and &gt; for '>'. If we want to display a line of code:
<button onclick="'Download.psp?param=hello','mywindow');" type="button" >Download</button>
We need to put following code in our blog:
&lt;button onclick=&quot;;Download.psp?param=hello&#039;,&#039;mywindow&#039;);&quot; type=&quot;button&quot; &gt;Download&lt;/button&gt;
The link to do this conversion is here

No comments:

Post a Comment