需求: 监听按钮的点击, 修改div中的内容
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="box"></div>
<button>按钮</button>
<script>
let message = 'BNTang';
const oDiv = document.querySelector('.box');
oDiv.innerText = message;
const oBtn = document.querySelector('button');
oBtn.onclick = function () {
message = 'www.it6666.top';
oDiv.innerText = message;
}
</script>
</body>
</html>