<body onload = "go()"> <div class = "elem"></div> <button onclick = "go()">click to change bgcolor</button> </body>
document.getElementsByClassName("elem").style.backgroundColor = "red";
div { width: 100px; height: 100px; border: 2px solid black; }
document.getElementsByClassName("elem")[0].style.backgroundColor = "red";
var els = document.getElementsByClassName("content-button"); for (var i = 0; i < els.length; i++) { els[i].style.backgroundColor = "red"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)