<!DOCTYPE html>
<html>
<body class='xx'>
<p id="demo"></p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var x=document.getElementById("demo");
x.innerHTML=document.body.class;
}
</script>
</body>
</html>
你能不能看一看API document.body.className
document.body.classList
哪里有class属性