Tutorials Point


  JavaScript Basics
  JavaScript Objects
  JavaScript Advanced
  JS Useful References
  JS Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

Javascript String - fontsize() Method


previous next AddThis Social Bookmark Button


Advertisements

Description:

This method causes a string to be displayed in the specified size as if it were in a <font size="size"> tag.

Syntax:

string.fontsize( size )

Here is the detail of parameters:

  • color: 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:

<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>

This will produce following result:

<font size="3">Hello world</font>

To understand it in better way you can Try it yourself.



previous next Printer Friendly

Advertisements


  

Advertisements