<html>
<body>
<h1 style="color:red;">Hello World</h1>
<p id="demo">Click the button to change the style attribute of the header above.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var h=document.getElementsByTagName("H1")[0];
h.getAttributeNode("style").value="color:green";
}
</script>
</body>
</html>