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

此方法用来将用户输入内容中的尖括号、引号等进行转义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:http://www.cnblogs.com/meimeiwa/p/html_code.html