LDD Today

Tips from LDD
Setting font properties with JavaScript

Tip submitted by
Fredrik Malmborg

Level: Intermediate
Works with: Notes/Domino
Updated: 02-Jan-2003

Have you ever had problems displaying rich text content on the Web and maintaining a consistent look and feel? Then explore the possibilities of JavaScript and DOM. With this little script called in the onLoad event of a form, you can set the font and size of all text on a document to your preferred settings, regardless of the settings the author chose when entering the text in Notes. Note that this JavaScript works in Microsoft Internet Explorer browsers only.
In the previous code, document.all.length contains the number of tags in the document. You can get a handle to a tag by addressing the index (0, 1, 2, and so on) or the ID. For example,

<HTML> <BODY>
document.all[0] is the <HTML> tag, document.all[2] is the <TITLE> tag, and document.all["myTag"] is the <SPAN> tag.


SUBMIT YOUR TIPS!
We encourage you to send us your tips (You can also click the "Would you like to submit a tip?" graphic below.) Your tips can be anything you've discovered about any Lotus product. The most important thing is that your tip be interesting, useful, or handy. And be sure to include complete information about how your tip works. For ideas, take a look at our tip archives. If we publish your tip, we'll send you the IBM Redbooks Lotus Collection on CD.