<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document
</title>
</head>
<body>
<button>按钮
</button>
<script>
var but = document.querySelector('button')
but.onclick = function () {
var h5 = document.querySelector('html')
if (h5.style.backgroundColor == 'white') {
h5.style.backgroundColor = 'black'
} else {
h5.style.backgroundColor = 'white'
}
}
</script>
</body>
</html>
转载请注明原文地址:https://blackberry.8miu.com/read-14523.html