font

英[fɒnt] 美[fɑ:nt]

n. Font; font; baptistery (located in a church, often made of stone ); (same font and size) a pair of typefaces

plural: fonts

color

英['kʌlə(r)] 美[ ˈkʌlɚ]

n.<Beauty>color, color; skin color, complexion, blood color; pigment, dye; essence

v.<Beauty> to color...; to change... color; whitewash, rendering, coloring; blush

Third person singular: colors Plural: colors Present participle: coloring Past tense: colored Past participle: colored

javascript fontcolor() method syntax

Function: Display the string according to the specified color.

Syntax: stringObject.fontcolor(color)

Parameters: color Required. Specifies the font-color for the string. The value must be a color name (red), an RGB value (rgb(255,0,0)), or a hexadecimal number (#FF0000).​

javascript fontcolor() method example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">
//字符串显示为红色
    var str="Hello world!"
    document.write(str.fontcolor("Red"))

</script>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance