Home > Web Front-end > HTML Tutorial > How to mark a specified string in a web page red? _html/css_WEB-ITnose

How to mark a specified string in a web page red? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:06:55
Original
2120 people have browsed it

Dear masters, I want to mark the string containing a string followed by a space in red in an output character. I wonder if you have any good suggestions? I wrote it in PHP. I can get the key strings. For example: the source string is I come from China! What I want is that I know the key word come, but I don’t know the following from. I want to mark both come and from in red! I don’t know, does anyone have any good opinions?
I can already display these strings in the browser!


Reply to discussion (solution)

Can I add another point here. .


If you want to write it in php code, the regular writing method is similar to JS. Try writing it yourself.

It mainly depends on when the data of your page is loaded. If the data exists when the page is generated, then it is best to write it in php. If it is the data obtained later using ajax request, It's better to use js.

Make your decision based on the actual situation.

Can I add another point here. .


If you want to write it in php code, the regular writing method is similar to JS. Try writing it yourself.

It mainly depends on when the data of your page is loaded. If the data exists when the page is generated, then it is best to write it in php. If it is the data obtained later using ajax request, It's better to use js.

Make your decision based on the actual situation.

Thanks for the help (PS: Besides giving you points, who else can I give them to?)

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template