api的应用场景:去掉目标字符串的<script>标签(包含里面的内容)
主要思想是prototype 1.6.0中的
Prototype.ScriptFragment = '<script[^>]*>([\\S\\s]*?)<\/script>';
stripScripts:function(){
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
}
去除HTML中<script>标签的JavaScript技巧
本文介绍如何使用JavaScript Prototype库中的方法去除HTML字符串中的<script>标签及其内容,适用于网页开发和处理。
api的应用场景:去掉目标字符串的<script>标签(包含里面的内容)
主要思想是prototype 1.6.0中的
Prototype.ScriptFragment = '<script[^>]*>([\\S\\s]*?)<\/script>';
stripScripts:function(){
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
}

被折叠的 条评论
为什么被折叠?