读书人

除去字符串中的html标签stripTags

发布时间: 2013-09-30 09:50:49 作者: rapoo

去掉字符串中的html标签stripTags

很多时候我们需要去掉字符串中的html标签

?

1、先看看prototype?1.6.0的写法:

?

?

/**stripTags -- 去掉目标字符串的html标签**@function**@param {String} source**@return {String} 去掉html标签的字符串**/ZYC.string.stripTags = function(source){    return String(source || '').replace(/<[^>]+>/g,'');};

读书人网 >CSS

热点推荐