网络编程 
首页 > 网络编程 > 浏览文章

通过脚本清空标签p中的class名和style 原创

(编辑:jimmy 日期: 2024/5/20 浏览:3 次 )

复制代码 代码如下:
<textarea name=jb51 cols=60 rows=6>  
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 0.05pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文本文本文本。</SPAN></p> 
</textarea><button onclick=alert(ubb(jb51.value))>alert</button>  
<script>  
function ubb(str)  
{  var strout;
    var re=/<p[\s\S]*?><span[\s\S]*?>(.*?)<\/span><\/p>/gi; 
    strout=str.replace(re,"<p>$1</p>");
return strout;
}  
</script>

上一篇:VBS中的正则表达式的用法大全 原创
下一篇:如何用正则取input type="text"中的value
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网