How To Use String Object FontColor In JavaScript
In this article I am going to explain about String Object FontColor In JavaScript.
Use fontcolor() method in JavaScript
If we want to display a string in a specified color then we can use a fontcolor() method.
The <font> tag is used to return a string in JavaScript, like this:
<font color="colorvalue">string</font>
All browsers support string object fontcolor() method.
Syntax
Example
<!DOCTYPE html>
<html>
<body Style="background-color:red">
<p id="demo">Click here</p>
<button onclick="myFunction()">Try it</button>
<script type="text/javascript">
function myFunction()
{
var txt = "Fontcolor:Hello World";
document.getElementById("demo").innerHTML = txt.fontcolor("Blue");
}
</script>
</body>
</html>
|
Output1
Output2
Further Readings
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here