<script type="text/javascript">
$("p.contents").each(function(index){
var html="";
html+=$(this).html();
var re1 = new RegExp("<.+?>","g");//匹配html标签的正则表达式,"g"是搜索匹配多个符合的内容
var msg = html.replace(re1,'');//执行替换成空字符
var thtml="";
thtml+=msg.substring(0,210);
thtml+="<span>[更多]</span>";
$(this).html(thtml);
});
</script>
js 过滤图片代码
最新推荐文章于 2024-03-23 14:11:01 发布