font | NN 6 IE 4 DOM 1 | ||
The font object reflects the font element. |
|||
HTML Equivalent | |||
<font> |
|||
Object Model Reference | |||
[window.]document.getElementById("elementID")
|
|||
Object-Specific Properties | |||
|
|||
Object-Specific Methods | |||
None. |
|||
Object-Specific Event Handler Properties | |||
None. |
color | NN 6 IE 4 DOM 1 |
Read/Write | |
Sets the font color of all text contained by the font element. |
|
Example | |
document.getElementById("myFont").color = "red"; |
|
Value | |
Case-insensitive hexadecimal triplet or plain-language color name as a string. See Appendix A for acceptable plain-language color names. |
|
Default | |
Browser default. |
face | NN 6 IE 4 DOM 1 |
Read/Write | |
Provides a hierarchy of font faces to use for the content surrounded by the current font object. The browser looks for the first font face in the comma-delimited list of font face names until it either finds a match in the client system or runs out of choices, at which point the browser default font face is used. Font face names must match the system font face names exactly. |
|
Example | |
document.getElementById("myFont").face = "Bookman, Times Roman, serif"; |
|
Value | |
One or more font face names in a comma-delimited list within a string. You may use real font names or the recognized generic faces: serif | sans-serif | monospace. |
|
Default | |
Browser default. |
size | NN 6 IE 4 DOM 1 |
Read/Write | |
The size of the font in the 1-7 browser relative scale. For more accurate font size settings, see the style.fontSize property later in this chapter. |
|
Example | |
document.getElementById("fontSpec2").size = "+1"; |
|
Value | |
Either an integer (as a quoted string) or a quoted relative value consisting of a + or - symbol and an integer value. |
|
Default | |
3 |