JavaScript fontsize() 方法
![String 对象参考手册](http://static.json.cn/r/uploadfile/up/3e/a9/18/41e5761fb9ace3ecbd611c59b218a93e.jpg)
定义和用法
fontsize() 方法用于按照指定的尺寸来显示字符串。
该方法返回加了 <font> 标签的字符串, 如下所示:
<font size="size">string</font>
语法
string.fontsize(size)
参数 | 描述 |
---|---|
size | 必须. size 参数必须是从 1 至 7 的数字。 |
浏览器支持
所有主要浏览器都支持 fontsize() 方法。
实例
实例
使用指定的尺寸来显示字符串:
<script>
var str = "Hello world!";
document.write(str.fontsize(7));
</script>
var str = "Hello world!";
document.write(str.fontsize(7));
</script>
运行代码 »
![String 对象参考手册](http://static.json.cn/r/uploadfile/up/3e/a9/18/41e5761fb9ace3ecbd611c59b218a93e.jpg)