fontsize

Non-standard

Summary

Causes a string to be displayed in the specified font size as if it were in a <FONT SIZE="size"> tag.

Method of String
Implemented in JavaScript 1.0
ECMAScript Edition none

Syntax

fontsize(size)

Parameters

size 
An integer between 1 and 7, a string representing a signed integer between 1 and 7.

Description

Use the fontsize method with the write or writeln methods to format and display a string in a document. In server-side JavaScript, use the write function to display the string.

When you specify size as an integer, you set the size of stringName to one of the 7 defined sizes. When you specify size as a string such as "-2", you adjust the font size of stringName relative to the size set in the BASEFONT tag.

Examples

Example: Using string methods to change the size of a string

The following example uses string methods to change the size of a string:

var worldString="Hello, world"

document.write(worldString.small())
document.write("<P>" + worldString.big())
document.write("<P>" + worldString.fontsize(7))

This example produces the same output as the following HTML:

<SMALL>Hello, world</SMALL>
<P><BIG>Hello, world</BIG>
<P><FONT SIZE="7">Hello, world</FONT>

See Also

big, small

Tags (1)

Edit tags

Attachments (0)

 

Attach file