最近客户有个需求:搜索多个关键字之后,高亮显示,并且忽略大小写:
function HighLight(nWord){
if(nWord!=''){
var keyword = document.body.createTextRange();
while(keyword.findText(nWord)){
keyword.pasteHTML("" + keyword.text + "");
keyword.moveStart('character',1);
}
}
}
function highword(nWord){
var array = nWord.split(" ");
for(var i=0;i
alert(array[i]);
HighLight(array[i]);
}
}
liujinzhong liujinzhong liuzhong |
liujinzhong liujinzhong liuzhong |
LiuJinzhong LIUjinzhong liuzhong |
liujinzhong liujinzhong liuzhong
阅读(797) | 评论(0) | 转发(0) |