Highlight Words

S

shapper

Hello,

I am creating a search engine which searches keywords inside SQL
database and displays the results in a web page.

In the results web page I would like to give a grey background to the
words which were used as Keywords for the search.

How can I do this?

Thanks,

Miguel
 
J

Joachim Pimiskern

shapper said:
In the results web page I would like to give a grey background to the
words which were used as Keywords for the search.

In HTML you can <b
style="color:black;background-color:#ffff66">colorize</b> text this way.

Regards,
Joachim
 
M

Mark Rae

I am creating a search engine which searches keywords inside SQL
database and displays the results in a web page.

In the results web page I would like to give a grey background to the
words which were used as Keywords for the search.

How can I do this?

I'm making the assumption here that you're talking about a string of HTML
here...

In which case, see here:
http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/csharp_0101.html

Scroll down to the section about replacing all occurrences of one string
with another string.

Substitute the first argument with your search word / phrase, and the second
with that word / phrase surrounded by a <div>...</div> tag where you set the
background colour to grey.
 
H

Hans Kesting

shapper said:
I'm making the assumption here that you're talking about a string of HTML
here...

In which case, see here:
http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/csharp_0101.html

Scroll down to the section about replacing all occurrences of one string with
another string.

Substitute the first argument with your search word / phrase, and the second
with that word / phrase surrounded by a <div>...</div> tag where you set the
background colour to grey.

a <span> tag would be better for "words", as this would keep the
highlighted word "inline". <block> would set it to it's own line.

Hans Kesting
 
M

Mark Rae

a <span> tag would be better for "words", as this would keep the
highlighted word "inline". <block> would set it to it's own line.

True enough - apologies...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top