将用户输入内容中的尖括号、引号等进行转义 - 梅梅哇

【摘要】此方法用来将用户输入内容中的尖括号、引号等进行转义function html_encode(str) { var s = ""; if (str.length == 0) return ""; s = str.replace(/&/g, ">"); s = s.replace(//g, ">"); s = s.replace(/ /g, ""); s = s.replace(/\'/g, "'"); s = s.re 阅读全文

文章来源:

Author:梅梅哇
link:https://www.cnblogs.com/meimeiwa/p/html_code.html