How can you highlight glossary terms on a page?
This example was written in response to a question Q_21517532 posted on
Expert's Exchange. The original question was how to highlight glossary terms, add a tooltip with a description related to the term and offer a link to the term's definition in another page.
Example:
The FBI's Internet Fraud Complaint Center (IFCC) reports a steady increase in complaints involving unsolicited e-mails directing consumers to a phony "customer service" Web site or directly asking for customer information. These scams are contributing to a rise in identity theft, credit card fraud, and other Internet-based frauds. E-commerce customers, including bank customers, have fallen victim to these scams.
Phishing involves sending customers a seemingly legitimate e-mail request for account information, often under the guise of asking the customer to verify or reconfirm confidential personal information such as account numbers, social security numbers, passwords, and other sensitive information. In the e-mail, the perpetrator uses various means to convince customers that they are receiving a legitimate message from someone whom the customer may already be doing business with, such as a bank. Techniques such as a false “from” address or the use of seemingly legitimate bank logos, Web links, and graphics may be employed to mislead the customer. After gaining the customer’s trust, the perpetrator attempts to convince the customer to provide personal information and provides one or more
methods for the customer to communicate that information back. For example, the e-mail might include a link to the perpetrator’s Web site that contains a form for entering personal information. Like the e-mail, the Web site is designed to trick the customer into believing it belongs to the bank. Alternatively, the e-mail might simply include an embedded form for the customer to complete. The ultimate goal of this fraud is to use the customer information to gain unauthorized access to a customer’s bank or financial accounts or to engage in other illegal acts.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.rodsdot.com/include/strictForm.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005, 2006 Roderick Divilbiss">
<title>Highlight Glossary Terms</title>
<script type="text/javascript">
<!--
// All of this should be in a single .js file and included in each page
var terms = new Array();
terms[0] = ['FBI','Federal Bureau of Investigation','definition.asp#fbi'];
terms[1] = ['e-mail','electronic mail','definition.asp#email'];
terms[2] = ['phony','not true, fake.','definition.asp#phony'];
function highlightGlossaryTerms(){
var temp = document.getElementById('theExample').innerHTML;
var tmpBody;
for (var idx=0;idx<terms.length;idx++){
tmpBody=temp.split(terms[idx][0]);
temp=tmpBody[0];
for (var jdx=1;jdx<tmpBody.length;jdx++)
temp+='<a href="'+terms[idx][2]+'" class="terms" title="'+terms[idx][1]+'">'+terms[idx][0]+'<\/a>'+tmpBody[jdx];
}
document.getElementById('theExample').innerHTML=temp;
}
//-->
</script>
<style type="text/css">
.terms {
font-weight: bold;
background-color: #FFFF66;
text-decoration:underline;
color:#800000;
}
</style>
</head>
<body>
<div id="theExample">
<strong>Example:</strong>
The FBI's Internet Fraud Complaint Center (IFCC) reports a steady increase in complaints involving unsolicited e-mails directing consumers to a phony "customer service" Web site or directly asking for customer information. These scams are contributing to a rise in identity theft, credit card fraud, and other Internet-based frauds. E-commerce customers, including bank customers, have fallen victim to these scams.<br>
<br>
Phishing involves sending customers a seemingly legitimate e-mail request for account information, often under the guise of asking the customer to verify or reconfirm confidential personal information such as account numbers, social security numbers, passwords, and other sensitive information. In the e-mail, the perpetrator uses various means to convince customers that they are receiving a legitimate message from someone whom the customer may already be doing business with, such as a bank. Techniques such as a false “from” address or the use of seemingly legitimate bank logos, Web links, and graphics may be employed to mislead the customer. After gaining the customer’s trust, the perpetrator attempts to convince the customer to provide personal information and provides one or more
methods for the customer to communicate that information back. For example, the e-mail might include a link to the perpetrator’s Web site that contains a form for entering personal information. Like the e-mail, the Web site is designed to trick the customer into believing it belongs to the bank. Alternatively, the e-mail might simply include an embedded form for the customer to complete. The ultimate goal of this fraud is to use the customer information to gain unauthorized access to a customer’s bank or financial accounts or to engage in other illegal acts.<br>
</div>
<div class="breaker"><br></div>
<div class="breaker"><br></div>
<div class="code">
<pre><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
</html></pre>
</div>
<script type="text/javascript">highlightGlossaryTerms();</script>
</body>
</html>
© Coyright 2000-2008, Roderick (Rod) W. Divilbiss. Some rights reserved.
Except where otherwise noted, this site, all content, and all source code and markup is licensed under a Creative Commons License
Creative Commons License.
No part of this web site including all application code and examples may be used for commercial purposes without prior written permission from the author,
Roderick W. Divilbiss of Overland Park, Kansas, United States of America.