<html>
<body>
<h3>如何访问 DIV 元素的演示</h3>
<div id="myDIV">This is a div element.</div>
<p>点击按钮获取 div 元素的内容。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myDIV").innerHTML;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>