'函数名:highlight '功能:搜索的关键词以高亮的颜色显示 '参数strtext是要被高亮显示的字符串或变量所在的字串或变量 'strfind是要被高亮显示的字符串或变量, 'strbefore被高亮显示的html代码前缀如:<font color=red> 'strafter被高亮显示的html代码的后缀:</font> '***************************************************** function highlight(strtext, strfind, strbefore, strafter) dim npos dim nlen dim nlenall nlen = len(strfind) nlenall = nlen + len(strbefore) + len(strafter) + 1 highlight = strtext if nlen > 0 and len(highlight) > 0 then npos = instr(1, highlight, strfind, 1) do while npos > 0 highlight = left(highlight, npos - 1) & _ strbefore & mid(highlight, npos, nlen) & strafter & _ mid(highlight, npos + nlen) npos = instr(npos + nlenall, highlight, strfind, 1) loop end if end function