突出显示文本区域中的搜索文本

问题描述:

我必须突出显示文本区域中的搜索项目。突出显示文本区域中的搜索文本

我有一个文本归档,搜索按钮和文本区域。

报价...

After i have enter the search string in the text field whenever i click the search button it highlight the search terms which is available in the text area and focus the search term in text area. 

I have try to do this by using jquery. 

But in mozilla,I can't get the focus to the search term at the time of search. 

I have to scroll down the text area for find the focused search term. 

In I.E. also it doesn't work properly. 

否则,如果突出显示文本区域搜索词相关的任何后也明显。

请指导我做到这一点。

+1

定义'高亮'。你不能真正突出textarea内的任何东西,你可以选择一个范围,就是这样。 – jAndy 2010-05-25 06:05:42

+0

Duplicate http://*.com/questions/2863641/highlight-changes/2863719#2863719 – 2010-05-25 12:24:01

在Internet Explorer上,我将使用TextRange对象与boundingTop属性值组合使用。

+0

这些是仅限IE和专有的,这限制了这种解决方案只能在IE中工作。 – 2010-05-25 08:20:35