Wednesday, May 20, 2009

How to write HTML / XML / Javascript code within post section as it is

If you wanted to publish some HTML or XML or javascript code withing a post and if you wish it should be visible as it is when it is published then here are some tips for that. From HTML code convert following characters to the relevant escape code as mentioned bellow and in the same order

  • Replace all & symbol with &
  • Then replace all < with &lt;
  • Replace all > with &gt;
  • Now replace all " with &quot;
After this you write converted code in the copose section of the post please see the bellow example if your code is
<a href="" > Latest Jokes </a>
Then you should convert it to
&alt;a href=&quot;; &gt; Latest Jokes &lt;/a&gt;

Share |

No comments yet


Embed Wave to Blogger