Page Stats
Visitor: 721
CSS Styling using JavaScript
Example 1: Change the style of an HTML elements using javascript.
<html>
<script>
function myFunction()
{
var x = document.getElementById("demo");
x.style.fontSize = "25px";
x.style.color = "red";
}
</script>
<body>
<p id="demo">
JavaScript can change the style of an HTML element.
</p>
<button type="button" onclick="myFunction()">
Click Me!
</button>
</body>
</html>