Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q5827 How can I automatically highlight keywords on a page?

You are here: irt.org | FAQ | ASP | Q5827 [ previous next ]

Simply replace the text with something that makes it stand out. See the example.

<!--THIS STYLE SHEET SIMPLY SETS UP
A YELLOW BACKGROUND HIGHLIGHTER
TO EMPHASIZE THE SPECIFIED TEXT
-->
<STYLE TYPE="text/css"><!--
  B.hl { background-color: #FFFF80 }
--></STYLE>

<%
'  DECLARE VARIABLES
Dim myText, replaceText, finalText

' HERE TEXT IS SIMPLY ASSIGNED TO A VARIABLE
' IT COULD EASILY COME FROM ANY SOURCE, SUCH
' AS A DATABASE

myText = "irt.org (www.irt.org) is a non-profit-making site for developers,
which covers Internet-related technologies that are cross-browser and
cross-platform compatible. There are over 100 articles plus FAQs on topics
such as HTML, JavaScript, Java, CGI/PERL and CSS. There's also a reviews
section, containing reviews of recommended books and software, and a
bulletin board where visitors can post their questions and problems or hold
discussions. The site can be downloaded for offline reading in several
different compression formats." & vbCrLF

myText = myText & "irt.org is maintained by an enthusiastic group of
people from all over the world, whom you can learn more about in the
irt.org profiles (www.irt.org/profiles/). You can also read about the
intentions of irt.org at www.irt.org/intent.htm"

' HERE'S WHAT WE WANT TO HIGHLIGHT
replaceText = "irt.org"

' REPLACE THE DESIRED TEXT WITH ITSELF ENCLOSED IN A BOLD
' TAG THAT REFERENCES THE STYLE DEFINED ABOVE
finalText = replace(myText, replaceText, "<b class='hl'>" &
replaceText & "</b>")

response.write myText & "<br><br>"
response.write finalText

%>

Feedback on 'Q5827 How can I automatically highlight keywords on a page?'

©2018 Martin Webb