fontsize()

The fontsize method is used to set the font size of the outputted string text. The value of this method may be between 1 and 7, which are the standard browser font sizes. If the number of the font size is set as a string value, the font size will reflect the size specified by the SIZE attribute of the HTML tag within the document. If no BASEFONT tag is present within the document, the default font size for the client's browser will be used.

syntax:

stringName.fontsize(number)

stringName.fontsize(string2Name)

EXAMPLE

bigString = new String("This is the string text, size 6.");

document.write(bigString.fontsize(6) )

The example first creates a new text string called bigString. A document.write statement is then used to write the contents of bigString to the window, invoking the fontsize() method, which has been set to size 6. The output should be the string "This is the string text, size 6.", which will be displayed in size 6 within your browser.