document.querySelector('html').style.margin = '0px'
document.querySelector('html').style.padding = '0px'
或 使用 ele.style.cssText = "css 样式"
document.querySelector('html').style.cssText = `margin: 0pxpadding: 0px`
用到js修改html的class属性值,归纳总结下:一、获取class属性值var value = $( div ).attr( class )//这里获取class属性值var array=val.spli.<pre><code class="language-bash">
xxxx
</code>
</pre>
<script>
window.onload=function(){
var codes=document.getElementsByTagName("code")
for(var i in codes){
if(codes[i].className&&codes[i].className.indexOf("language-bash")>-1){
codes[i].parentNode.className="command-line language-bash"
codes[i].parentNode.dataset.user="root"
codes[i].parentNode.dataset.host="localhost"
}
}
}
</script>