String.fontcolor()

書式

文字列オブジェクト.fontcolor(カラー名またはカラーコード)

説明

文字色を指定します。指定できる文字色はHTMLの<font>タグで指定できるものになります。また、新しいブラウザではCSSのcolorプロパティで設定するようにしてください。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
</head>
<body>
<script type="text/javascript"><!--
str = "Sample text";
document.write(str.fontcolor("#ff0000"));
// --></script>
</body>
</html>