Ask the Expert

Click checkbox and change font of the page

I have used one rtf field to input some details that are in both English and Tamil. When I copy and paste the details from some other file (doc file) it displays it as is (if it is English, English or if it is Tamil, Tamil) in Notes client.

I am using another form to display this content on the Web. English is displayed well, but Tamil takes some other font display as unknown characters. If I use a font tag before this field then it is ok, but I have check English and Tamil. If I select English, the content should be in English .If select Tamil, the content should be in Tamil. How can I do this?

If I understand your question correctly, I believe you want users to be able to click a checkbox and change the font of the page.

You should be able to do this with Dynamic HTML (DHTML) on the page, using JavaScript and CSS.

Below is a sample function that changes fonts when a link is clicked. To adapt it for your use, change the function calls in the links to pass the name of the fonts that you need to use. Also, make sure the text is enclosed in a DIV or SPAN tag with the ID "Content" (or change the JavaScript function to point to a different HTML element name).

<HTML>
<HEAD>
<SCRIPT>
function SetFont (FontName) {
 document.all.Content.style.fontFamily
 = FontName;
}
</SCRIPT>

</HEAD>
<BODY>

<A HREF="#" onClick=
"SetFont('Arial')">Set font to Arial</A>
<BR>
<A HREF="#" onClick=
"SetFont('Verdana')">Set font to Verdana</A>
<BR><BR>

<DIV ID="Content">
The font of this text will
 change when a link above is clicked.
</DIV>

</BODY>

Do you have comments on this Ask the Expert question and response? Let us know.

This was first published in February 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: