此方法會導致就好像它是在一個字符串被顯示在指定的顏色 <font color="color">標記。
語法
string.fontcolor( color )
下面是參數的詳細信息:
返回值:
例子:
<html>
<head>
<title>JavaScript String fontcolor() Method</title>
</head>
<body>
<script type="text/javascript">
var str = new String("Hello world");
alert(str.fontcolor( "red" ));
</script>
</body>
</html>
這將產生以下結果:
<font color="red">Hello world</font>