Copyright © tutorialspoint.com

Javascript String - fontcolor() Method

previous next

Advertisements


Description:

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

Syntax:

string.fontcolor( color )

Here is the detail of parameters:

Return Value:

Example:

<html>
<head>
<title>JavaScript String fontcolor() Method</title>
</head>
<body>
<script type="text/javascript">

var str = new String("Hello world");

alert(str.fontcolor( "red" ));

</script>
</body>
</html>

This will produce following result:

<font color="red">Hello world</font>

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


previous next

Copyright © tutorialspoint.com