Share via


fontcolor 方法

更新:2007 年 11 月

傳回一個在 String 物件之文字旁邊具有 COLOR 屬性 (Attribute) 的 HTML <FONT> 標記的字串。

 function fontcolor(colorVal : String) : String

引數

  • colorVal
    必要項。包含有色彩值的字串值。可以是十六進位的色彩值,或是預先定義色彩名稱。

備註

預先定義的色彩名稱是否有效,取決於您的 JScript 主應用程式 (瀏覽器、伺服器等等)。它們也可能會因您的主應用程式版本而有所不同。如需詳細資訊,請參閱您的主應用程式文件。

未檢查標記是否已套用至字串。

範例

以下範例說明如何使用 fontcolor 方法:

var strVariable = "This is a string";
strVariable = strVariable.fontcolor("red");

在最後一個陳述式之後,strVariable 的值為:

<FONT COLOR="RED">This is a string</FONT>

需求

1 版

套用至:

String 物件

請參閱

參考

fontsize 方法