Query full-text search keyword highlighted
// Go to all specified elements on the page based on the query keyword
// Search for the value that matches the keyword content, and add the COLOR attribute and bold attribute to the value
//
// Id: name of the HTML element to be searched
// Key: GET the keyword name queried above
// Color: highlighted color
// B: whether to bold
//--------------------------------------
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 <text. length; 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 = require (this).html ();
Var text_a = text. fontcolor (color );
Text_a = B = true? Text_a.bold (): text_a;
Var re = eval ('/' + text + '/I ');
Certificate (this).html (B. replace (re, text_a ));
});
}
}