标签:function return htm bsp element class doc 常用 extc
获取字符串长度
function GetStringLength(str) { return str.replace(/[^x00-xff]/g, "01").length; }
通过js对html转义和反转义
function HTMLEncode(html) { var temp = document.createElement("div"); (temp.textContent != null) ? (temp.textContent = html) : (temp.innerText = html); var output = temp.innerHTML; temp = null; return output; } function HTMLDecode(text) { var temp = document.createElement("div"); temp.innerHTML = text; var output = temp.innerText || temp.textContent; temp = null; return output; }
标签:function return htm bsp element class doc 常用 extc
原文地址:http://www.cnblogs.com/wz122889488/p/7122721.html