skip to main | skip to sidebar

Brain Of Dave

Dave Of Brain

Showing posts with label HTMLEncode. Show all posts
Showing posts with label HTMLEncode. Show all posts

Thursday, September 25, 2008

JavaScript HTMLEncode function

Found this neat trick on another blog (http://lunarmedia.com/blogs/lunarmedia_blog/archive/2006/10/23/120405.aspx) to escape characters for presentation in HTML:

function escapeHTML (str)
{
   var div = document.createElement('div');
   var text = document.createTextNode(str);
   div.appendChild(text);
   return div.innerHTML;
}; 

Posted by Dave at 10:45 AM 2 comments:
Labels: HTMLEncode, JavaScript
Older Posts Home
Subscribe to: Posts (Atom)

Blog Archive

  • ▼  2014 (1)
    • ▼  November (1)
      • DevExpress WinForms GridView RepositoryItemButtonE...
  • ►  2011 (1)
    • ►  March (1)
  • ►  2009 (6)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  April (2)
    • ►  January (1)
  • ►  2008 (22)
    • ►  December (2)
    • ►  November (1)
    • ►  October (2)
    • ►  September (2)
    • ►  August (1)
    • ►  July (2)
    • ►  June (4)
    • ►  April (3)
    • ►  March (1)
    • ►  February (1)
    • ►  January (3)
  • ►  2007 (22)
    • ►  December (1)
    • ►  November (1)
    • ►  October (2)
    • ►  August (4)
    • ►  July (3)
    • ►  June (7)
    • ►  May (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2006 (7)
    • ►  December (2)
    • ►  November (5)

About Me

Dave
View my complete profile