日期:2014-05-16 浏览次数:22530 次
var str = 'fds fs df <span style="color:#FF0000;"> fdsfsdfds</span>fdsf sd <div a="s s"> f dsd </div> '; var a = str.replace(/^[^<>]*<|>[^<>]*<|>[^<>]*$/g, function(){ return arguments[0].replace(/\s/g, " "); }); alert(a);