1<!DOCTYPE html>
2<html>
3<head>
4<script>
5function display()
6{
7var col=document.getElementById("demo");
8col.style.color="#FF0000";
9}
10</script>
11</head>
12<body>
13
14<h1>My First JavaScript</h1>
15<p id="demo">click on the button below.....</p>
16
17<button onclick="display()">Display</button>
18
19</body>
20</html>
1var span = document.getElementsByTagName("span")[0];
2span.style.color = "red";
1document.getElementBiId("your id").style.color = "your color";
2//it can also be used as:
3document.body.style.backgroundColor = "your color";