通过脚本清空标签p中的class名和style 原创
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:文本文本文本。alertfunctionubb(str){varstrout;varre=/(.*?)/gi;strout...
复制代码 代码如下:
<textareaname=jb51cols=60rows=6>
<Pclass=MsoNormal><SPANTimesNewRoman';mso-hansi-font-family:'TimesNewRoman'">文本文本文本。</SPAN></p>
</textarea><buttononclick=alert(ubb(jb51.value))>alert</button>
<script>
functionubb(str)
{varstrout;
varre=/<p[sS]*?><span[sS]*?>(.*?)</span></p>/gi;
strout=str.replace(re,"<p>$1</p>");
returnstrout;
}
</script>