您的浏览器过于古老 & 陈旧。为了更好的访问体验, 请 升级你的浏览器
Ready 发布于2014年08月11日 10:09

原创 JavaScript String.fontcolor() 函数详解

1668 次浏览 读完需要≈ 3 分钟

内容目录

fontcolor()函数返回以当前字符串为文本内容、以指定字符串为color属性值的<font>标签字符串。

该函数属于String对象,所有主流浏览器均支持该函数

语法

stringObject.fontcolor( colorValue )

参数

参数 描述
colorValue String类型指定的颜色值,用做<font>标签的color属性值。

返回值

fontcolor()方法的返回值为String类型,其返回值形如:

<font color=" colorValue"> stringObject</font>

示例&说明

var str = "Google搜索引擎";
document.writeln( str.fontcolor("red") ); // <font color="red">Google搜索引擎</font>

str = "Code Player";
document.writeln( str.fontcolor("#fcf") ); // <font color="#fcf">Code Player</font>

运行代码

  • CodePlayer技术交流群1
  • CodePlayer技术交流群2

0 条评论

撰写评论

打开导航菜单