document.ElementById("id").style.样式=“”;
注意:document.getElementByClassName(“class”) 返回这个class数组 [0]
例子:
document.getElementById("del-ad").onclick=function(){
document.getElementsByClassName("advert")[0].style.opacity="0";
document.getElementsByClassName("advert")[0].style.transition="1s";
setTimeout(
function(){
document.getElementsByClassName("advert")[0].style.display="none";
},1000
);
}