From http://www.w3schools.com (Copyright Refsnes Data)

JavaScript fontcolor() Method


String Object Reference JavaScript String Object

Definition and Usage

The fontcolor() method is used to display a string in a specified color.

Syntax

stringObject.fontcolor(color)

Parameter Description
color Required. Specifies a color. The value can be a color name (red), an RGB value (rgb(255,0,0)), or a hex number (#FF0000)


Example

Example

Display the text in red:

<script type="text/javascript">

var str="Hello world!";
document.write(str.fontcolor("red"));

</script>

Try it yourself »


String Object Reference JavaScript String Object

From http://www.w3schools.com (Copyright Refsnes Data)