把带有 color 属性的一个 html <font> 标记放置在 string 对象中的文本两端。
strvariable.fontcolor(colorval)
参数
strvariable
必选项。任意的 string 对象或文字。
colorval
必选项。为包含颜色值的字符串值。可以是颜色的十六进制值,或预先定义好的颜色名字。
说明
下面的示例说明了 fontcolor 方法:
var strvariable = "this is a string";strvariable = strvariable.fontcolor("red");最后一条语句执行完后,strvariable 的值是:
<font color="red">this is a string</font>有效的预定义颜色名取决于 jscript 主机(浏览器、服务器,等等)。它们也可能由主机版本的不同而不同。详细信息请查阅主机的说明书。
不检查该标记是否已经被应用于该字符串了。
闽公网安备 35060202000074号