x
 
<!DOCTYPE html>
<html>
<body>
<h1>设置文本内容</h1>
<h2 id="01">Hello China!</h2>
<h2 id="02">Hello World!</h2>
<script>
var myElement = document.getElementById("02");
myElement.textContent = "Hello Shanghai!";
</script>
</body>
</html>