File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes how to manipulate fonts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to manipulate fonts?" Watch "how to manipulate fonts?" New topic
Author

how to manipulate fonts?

Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

How can i give a specific font face,size,color in JavaScript?
document.fgColor = "blue"; means foreground color of all fonts but i want some particular fonts to manipulate as we did in HTML thru "<font face color size>Some</font>"....anyone help...
------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer for the Java� 2 Platform
--When you learn something, learn it by heart!


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
David Kane
Ranch Hand

Joined: Sep 20, 2001
Posts: 65
There is a pretty good example of this at:
http://www.mozilla.org/docs/dom/samples/dom-css-fonts/colorfades.html
There are two keys to this code, that address your concern. First, use a DIV with ID attribute around the text you want to alter.
Second, the following line, gets this object and alters its CSS properties. The following line from the page above illustrates this.
document.getElementById("text"+el).style.color="rgb("+aa+","+aa+","+aa+")";
Good luck!
David
------------------
David Kane
david_kane@houseofyin.com
Author of Software Architecture: Organizational Principles and Patterns
http://www.vraps.com
http://www.houseofyin.com


David Kane<BR> <A HREF="mailto:david_kane@houseofyin.com" rel="nofollow">david_kane@houseofyin.com</A> <BR>Author of <A HREF="http://www.amazon.com/exec/obidos/ASIN/0130290327/ref=ase_electricporkchop/103-0514572-3811868" TARGET=_blank rel="nofollow">Software Architecture: Organizational Principles and Patterns</A><BR><A HREF="http://www.vraps.com" TARGET=_blank rel="nofollow">http://www.vraps.com</A><BR><A HREF="http://www.houseofyin.com" TARGET=_blank rel="nofollow">http://www.houseofyin.com</A>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to manipulate fonts?