Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search result - underline the keyword in the result

Status
Not open for further replies.

hazelvenus

Programmer
Jun 20, 2001
4
AE
hi there,
i have a search form (search.cfm) where the user enters a keyword to find. in the result page (result.cfm), i want the keyword that the user entered to be underlined within the result. suppose that the keyword is (web), and the result is (web development, website, and web, all are ...), then three words should be underlined.

do you have any idea how to implement that with coldfusion?

with regards.
 
Hi hazelvenus,

Suppose you have form variable: FORM.vrKeyword
(Ofcourse, this will contain the word 'web').

Then, you have a db field: qrName.content

Thus, you can use this:

#ReplaceNoCase(qrName.content,FORM.vrKeyword,&quot;<span class='underline'>&quot; & FORM.vrKeyword & &quot;</span>&quot;,&quot;ALL&quot;)#

This should do the trick.

(In the CSS class you just add: text-decoration:underline)

Hope it gets you further? :p

Gtz,

Kristof Check out my brand new site:

Any suggestions are more than welcome.
There's a LOT of work to do, so judge fairly. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top