通过脚本清空标签p中的class名和style 原创
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:文本文本文本。alertfunctionubb(str){varstrout;varre=/(.*?)/gi;strout...
复制代码 代码如下:
<textareaname=jb51cols=60rows=6>
<Pclass=MsoNormalstyle="MARGIN:0cm0cm0pt0.05pt;TEXT-INDENT:21pt;mso-char-indent-count:2.0;mso-char-indent-size:10.5pt"><SPANstyle="FONT-FAMILY:宋体;mso-ascii-font-family:'TimesNewRoman';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>