有没有方法给html进行编码?
例如把 " < "、 "> "等字符编码成<、>这种格式?
[解决办法]
String.prototype.replaceStr=function(){return this.replace(/&/g, "& ").replace(/\ "/g, "" ").replace(/ </g, "< ").replace(/> /g, "> ");}
发布时间: 2012-03-06 20:47:55 作者: rapoo
有没有方法给html进行编码?
例如把 " < "、 "> "等字符编码成<、>这种格式?
[解决办法]
String.prototype.replaceStr=function(){return this.replace(/&/g, "& ").replace(/\ "/g, "" ").replace(/ </g, "< ").replace(/> /g, "> ");}