document.ids.fontFamily

JavaScript 1.2+ Nav4+ Syntax

document.ids.idName.fontFamily

Description

The fontFamily property specifies the font an element should use when associated with the ID called idName. More than one font can be specified, in case a particular font has not been loaded.

Example

Listing 7.117 uses the fontFamily property to create text with an Arial font. If that font is not available, Helvetica is used.

Listing 7.117 Set the fontFamily Property
<html>

<script>
<!-- Hide

//Create a style sheet id that defines a font
document.ids.F.fontFamily = "Arial, Helvetica";

							

//Hide End --->
</script>

<p id=F>Do you like this font?</p>

</html>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.