Posted By

vasilije on 10/14/08


Tagged

javascript htmlencode


Versions (?)

JavaScript HTML character encoding


 / Published in: JavaScript
 

  1. function HTMLEncode(str){
  2. var result = '';
  3. for(var i=0; i<str.length; i++){
  4. result += '&#' + str.charCodeAt(i) + ';';
  5. }
  6. return result;
  7.  
  8. }

Report this snippet  

You need to login to post a comment.