调用 

做站内搜索的 ,js 实现的 一般都会用到,感觉还不错.

var someKeyWords = "......";  


    $( "#div_Text" ).highlight(someKeyWords);  

Available Options


The following list describes what options you have for the second argument of the method "highlight" (option object):


hClass
Specifies the CSS class used to highlight key words.
Data Type: String
Default Value: null

 

hColor
Specifies the color used to highlight key words. If you setted the hClass option, this option will be ignored.
Data Type: String
Default Value: "#C03"

 

separator
The symbol used to separate multiple keywords.
Data Type: String
Default Value: " "

 

wrapper
Specifies the HTML tag used to wrap the keywords.
Data Type: String
Default Value: "em"

 

useDefaultStyle
When not set hClass option, specify whether to use the default style to highlight the keywords (eg: use the hColor option).
Data Type: Boolean
Default Value: true

 

needUnhighlight
Specifies whether need the function of cancel the highlighted keywords or highlight keywords several times within the same container tag.
Data Type: Boolean
Default Value: false