Fork me on GitHub
代码改变世界

js 过滤html

2013-01-07 16:59  freefei  阅读(244)  评论(0编辑  收藏  举报
[js] function removeHTMLTag(str) { str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白 //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行 str=str.replace(/&nbsp;/ig,'');//去掉&nbsp; return str; } [/js]
@ https://github.com/ranmufei

守望者舆情监控

守望者舆情监控系统