<html>
<body>
<h1>HTML DOM insertAdjacentText() 方法</h1>
<p>此方法将指定文本插入到指定位置。</p>
<h2 id="myH2">我的标题</h2>
<p>单击按钮以在标题中插入一些文本:</p>
<button onclick="myFunction()">插入文字</button>
<script>
function myFunction() {
var h = document.getElementById("myH2");
h.insertAdjacentText("afterbegin", "我的插入文本");
}
</script>
</body>
</html>