您的位置:首页源码下载JavaScript代码

jQuery Highlighter v1.0下载

授权形式: 免费版
更新时间: 2010-10-24 16:21:53
软件语言: 英文
软件平台: Windows,Linux
软件类别: 程序源码
文件大小: 5.1K
评论等级: ★★★☆☆
下载次数: 0(今日:,本周:,本月:

软件简介

jQuery Highlighter 是一个用来高亮显示文本关键字的 jQuery 插件。

功能特定

    * 支持同时高亮多个关键字
    * 多个关键字之间可以重叠
    * 能够取消高亮关键字

使用方法:

   1. Include jQuery and the Highlighter plugin script file in your HTML page:

       <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
       <script type="text/javascript" src="jquery.highlighter-1.0.0.min.js"></script>

   2. In your HTML body create a container tag pair that will hold some text.Give it an id or class attribute (e.g. "News-Pagination"). This attribute can used as the selector for jQuery.
   3. Write some text into the previously created container tag, that contain the key words you want to search .
   4. Write the JavaScript code in your HTML head:

       <script type="text/javascript">
           // Some key words that within the previously created container tag.
           // Use one space to separate multiple keywords.
           var someKeyWords = "......";
           $("#div_Text").highlight(someKeyWords);
       </script>

   5. Use your favorite browser to view this page, you will see the keywords are marked red.
   6. If you want to cancel the highlighted keywords or need to highlight keywords several times within the same container tag:

       // Highlight key words.
       // Note the second argument.
       $("#div_Text").highlight(someKeyWords, {needUnhighlight: true});

       // Cancel the highlighted keywords.
       $("#div_Text").unhighlight();

在线测试页面:http://xujinnet.github.com/jQuery-Highlighter/jQuery-Highlighter-Test-Page.html

赞助商链接: