如何使用CSS或javascript更改语句中某些单词的颜色. [英] How to change color of some words in a statement using CSS or javascript.

查看:129
本文介绍了如何使用CSS或javascript更改语句中某些单词的颜色.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序-@ http://onetooneguidance.com/faqs,在这里我为用户提供搜索功能.现在,我想在用户搜索结果中提供一些用户想要搜索的颜色.
示例-搜索文字-教育
结果-现在,在我的搜索结果中,存在哪些包含教育性单词的问题和答案越来越多,因此我想在存在教育性"单词的每个位置都涂上绿色.
预先感谢.

I have one application -@ http://onetooneguidance.com/faqs, where i give search facility to users. Now, i want to give some color which user wants to search in my search result.
Example - search text - education
Result - Now in my search result,there are lot more questions and answers present which word containing education, so i want to give green color every where the word "education is present".
Thanks in advance.

推荐答案

看看这些:
使用JavaScript在网页上搜索并突出显示文本 [如何使用JavaScript和CSS突出显示搜索结果 [此处 [
Have a look at these:
Using JavaScript to Search For and Highlight Text on a Web Page[^]
How to highlight search results with JavaScript and CSS[^]

If needed, look here[^] for more.


这篇关于如何使用CSS或javascript更改语句中某些单词的颜色.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆