描述
此方法使字符串以指定大小显示,就像它在 <font size = “size”> 标签中一样。
语法
它的语法如下 -
string.fontsize( size )
属性详细信息
- size − 介于 1 和 7 之间的整数,表示介于 1 和 7 之间的有符号整数的字符串。
返回值
返回带有 <font size=“size”> 标签的字符串。
例请尝试以下示例。
<html>
<head>
<title>JavaScript String fontsize() Method</title>
</head>
<body>
<script type = "text/javascript">
var str = new String("Hello world");
alert(str.fontsize( 3 ));
</script>
</body>
</html>
输出
<font size = "3">Hello world</font>