JavaScript div id добавить класс

var d = document.getElementById("div1");
d.className += " otherclass";
Shadow