Home > Article > Web Front-end > js setattribute sets css styles in batches_javascript skills
Firefox, etc. can use
var dom=document.getElementById("name");
dom.setAttribute("style","width:10px;height:10px;border:solid 1px red;");
In IE, style.cssText must be used
var dom=document.getElementById("name");
dom1.style.cssText = "width:10px;height:10px;border: solid 1px red;";
To add, style.cssText is now similar to innerHTML and has become a de facto standard for web development. So the test shows that the firefox browser also supports this method.