最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
query 全文检索关键词高亮显示
时间:2010-05-04 编辑:简简单单 来源:一聚教程网
query 全文检索关键词高亮显示
// 根据查询的关键字去页面中所有指定的元素中去
// 查找符合关键字内容的值,并将该值加了COLOR的属性以及加粗的属性
//
//id:需要查找的HTML元素名称
//key:GET上面查询关键字名称
//color:高亮的颜色
//b:是否加粗
//--------------------------------------
function differ_text(id,key,color,b)
{
var text;
text =location.search.substring(1);
text = text.replace(/&/ig,",");
text = text.replace(/=/ig,",");
text = text.split(",");
for(i=0;i
if(text == key && text[(i+1)] != undefined)
{
text = decodeURI(text[(i+1)]);
text = text.replace(/\/ig,'\');
text = text.replace(/'/ig,'\'');
text = text.replace(/"/ig,'\"');
break;
}
}
if(text == null || text == '' || text == undefined)
{
return false;
}
if(text.length > 0)
{
$(id+":only-child:contains('"+text+"')").each(function (i){
var b = $(this).html();
var text_a = text.fontcolor(color);
text_a = b == true ? text_a.bold () :text_a;
var re = eval('/'+text+'/i');
$(this).html(b.replace(re,text_a));
});
}
}
-
下一个: 电话号码正则表达式
相关文章
- 魅族PRO 7亮相工信部 副屏像智能冰箱显示器 07-20
- 显示器画面抖动是什么原因 怎么解决画面抖动 07-15
- CAD中标题栏显示不全怎么解决 07-10
- word单页显示效果怎么做 07-04
- 针对不同显示器 微软Xbox One X智能适配4K材质包 06-27
- ps如何绘制一个复古风格的CRT显示器故障图 06-20