批量设置 style

firefox等可以使用:

document.getElementById("id").setAttribute("style","top:20px;left:20px;color:red;");
IE中则必须使用style.cssText

document.getElementById("id").style.cssText = "top:20px;left:20px;color:red;";

原文地址:https://www.cnblogs.com/WhiteHorseIsNotHorse/p/8541124.html