ygunoil
//文字变红色
//content:关键字
//ele:内容区域
Common.prototype.textToRed =function(content, ele) {
var bodyHtml = $(ele).html();
//去掉标红的font标签
bodyHtml = bodyHtml.replace(/<\/?font[^>]*>/gi,"");
var reger = new RegExp("(>|^)([^<]*)(" + content + ")([^>]*<)","gm");
//添加标红的font标签
var reslut = bodyHtml.replace(reger, "$1$2<font color=\'red\'>$3</font>$4");
$(ele).html(reslut);
}

分类:

技术点:

相关文章:

  • 2021-05-30
  • 2022-12-23
  • 2021-05-25
  • 2021-05-28
  • 2021-09-17
  • 2021-08-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2021-06-20
相关资源
相似解决方案