Find the search results page in the folder "C:\Program Files\Common Files\Microsoft Shared\Web Server extensions\60\template\layouts\2052" searchresults.aspx, edit the file.
Insert the following JavaScript before closing the label "</body>".
var strsearchterm = document.forms["Frmsearch"].elements["searchstring"].value;
Highlightsearchterm (Strsearchterm);
function Highlightsearchterm (strsearchterm)
{
var celltables = document.all.tags ("table");
var strsearchterm = Strsearchterm.tolowercase ();
if (Strsearchterm = "")
Return
for (var II = 0; II < celltables.length; ii++)
{
if ((celltables[ii].all["Frmsearch"]!= null) | | (Celltables[ii].classname!= ""))
Continue
var celltags = celltables[ii].all.tags ("TD");
for (var III = 0; III < celltags.length; iii++)
{
if (celltags[iii].classname!= "Ms-vb")
Continue
var strbodytext = celltags[iii].innerhtml;
var strText = Strbodytext.tolowercase ();
var i =-1;
var strnewtext = "";
while (Strbodytext.length > 0)
{
i = Strtext.indexof (Strsearchterm, i+1);
if (I < 0)
{
strNewText + = Strbodytext;
Strbodytext = "";
}
Else
{
if (Strbodytext.lastindexof (">", i) >= strbodytext.lastindexof ("<", i))
{
if (Strtext.lastindexof ("/script>", i) >= strtext.lastindexof ("<script", I))
{
strNewText + + strbodytext.substring (0, I) + "<b style= ' Color:black;" Background-color: #ffff66 ' > ' + strbodytext.substr (i, strsearchterm.length) + "</B>";
Strbodytext = strbodytext.substr (i + strsearchterm.length);
StrText = Strbodytext.tolowercase ();
i =-1;
}
}
}
}
celltags[iii].innerhtml = strNewText;
}
}
}
Save and close the paging file.
Now, when you search for a keyword in the WSS site, the result will be the same as Google highlighting the keyword. J
Original address: http://msd2d.com/newsletter_tip.aspx?section=sharepoint&id=c89e3424-d7e6-4f79-9c89-be219513357b