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

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

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

内容目录

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

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

语法

stringObject.fontsize( sizeValue )

参数

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

返回值

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

<font size=" sizeValue"> stringObject</font>

示例&说明

var str = "Google搜索引擎";
document.writeln( str.fontsize( 2 ) ); // <font size="2">Google搜索引擎</font>

str = "Code Player";
document.writeln( str.fontsize( 6 ) ); // <font size="6">Code Player</font>

运行代码

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

0 条评论

撰写评论

打开导航菜单