JavaScript String - fontsize() Method
Description
This method causes a string to be displayed in the specified size as if it were in a <font size = "size"> tag.
Syntax
Its syntax is as follows −
string.fontsize( size )
Attribute Details
size − An integer between 1 and 7, a string representing a signed integer between 1 and 7.
Return Value
Returns the string with <font size="size"> tag.
Example
Try the following example.
<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>
Output
<font size = "3">Hello world</font>
javascript_strings_object.htm
Advertisements