js中innerHMTL、innerText、outerHTML中关于<table>、<tr>、<td>、<br>、<input>、<a>、<div>、<span>等标签及空格换段  转义字符是怎样的?
      求解!谢谢!

解决方案 »

  1.   

    你是说&lt &gt &nbsp什么的?
      

  2.   

    楼主是说特殊字符转义对吗?这个有专门的一套代码,google一下就有很多,搜js特殊字符转义就可以
      

  3.   

    HTML 实体转义
    1. &#{unicode编码};  
    str = str.replace(/[>&<'"]/g, function(x) { return "&#" + x.charCodeAt(0) + ";"; });2. &#x{16进制Unicode编码};
    3. 部分字符有命名实体转义,如:
    & ------> &amp;
    < ------> &lt;
    > ------> &gt;
    © ------> &copy;
    ...