August 1999
Intermediate to advanced
1488 pages
72h 53m
English
string.fontsize(num) string.fontsize(string2)
The fontsize() method sets the SIZE attribute of an instance of the <font> tag, which it creates. This attribute can be a number between 1 and 7. If you pass the method the number in the form of a string, the size displayed is relative to the <basefont> tag.
Listing 6.238 creates an instance of the String object and uses the document.write() method to write two instances of the tag to the page. The results of running this script will be the following:
Hex usage: <font size="6">Hello, World!</font> <br>Color usage: <font size="-2">Hello, World!</font>
Read now
Unlock full access