如何去除页面源文件中的JS脚本和JS调用,大神们有没简单的方法和思路? 没错,就是这样一个需求;我现在有页面源文件的HTML字符串,但是我需要去除里面的JS脚本,当然也要同时去除标签中JS的调用哪位有实现的经验和思路可共享下,急急急!!!!~在线等... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我就是用的正则表达式去的JS脚本关键就是调用那块儿 实在是头痛啊不过还是谢谢 KK3K2005 顺便问一下,我用正则表达式去除JS脚本下面的代码有问题吗?System.Text.RegularExpressions.Regex.Replace(htmlStr, @"<script[^>]*?>.*?</script>", "",System.Text.RegularExpressions.RegexOptions.IgnoreCase); 为什么这个问题没人关注呢?自己再顶下去除JS脚本已经实现了关键是去除页面中对JS的调用我现在是通过JQuery的笨方法实现的如:$("#div_Preview_Content *").each(function () { $(this).removeAttr("onblur"); $(this).removeAttr("onclick"); $(this).removeAttr("ondblclick"); $(this).removeAttr("onfocus"); $(this).removeAttr("onkeydown"); $(this).removeAttr("onkeypress"); $(this).removeAttr("onkeyup"); $(this).removeAttr("onmousedown"); $(this).removeAttr("onmouseout"); $(this).removeAttr("onmousemove"); $(this).removeAttr("onmouseover"); $(this).removeAttr("onmouseup"); });但是这样的实现方式,性能明显达不到要求谁能提供更好的实现或思路吗? 请教一个问题,谢谢大家 扫描二维码串口数据读取至网页中 js怎么取到struts2传过来的inputstream流? 类似于这样的效果该如何写,思路如何 如何移动一个文本框且同时可以打字 请教滚动新闻的问题 如何在客户端得知欲上传的文件的字节数 提个问题,高手勿笑 刚才没说清楚,这次争取说清楚一点 看到老外用这样一行代码来判断浏览器版本,哪位能够解释一下是什么意思? 求助牛人!javascript怎样实现检查当前站点是不是可信站点? 急 ,高级JS求助。 一个弱弱的问题。
我就是用的正则表达式去的JS脚本
关键就是调用那块儿 实在是头痛啊
不过还是谢谢 KK3K2005
下面的代码有问题吗?System.Text.RegularExpressions.Regex.Replace(htmlStr, @"<script[^>]*?>.*?</script>", "",System.Text.RegularExpressions.RegexOptions.IgnoreCase);
$("#div_Preview_Content *").each(function () {
$(this).removeAttr("onblur");
$(this).removeAttr("onclick");
$(this).removeAttr("ondblclick");
$(this).removeAttr("onfocus");
$(this).removeAttr("onkeydown");
$(this).removeAttr("onkeypress");
$(this).removeAttr("onkeyup");
$(this).removeAttr("onmousedown");
$(this).removeAttr("onmouseout");
$(this).removeAttr("onmousemove");
$(this).removeAttr("onmouseover");
$(this).removeAttr("onmouseup");
});但是这样的实现方式,性能明显达不到要求谁能提供更好的实现或思路吗?