<body>
<h2 id="con">JavaScript</h2>
<p>HelloWorld</p>
<script type="text/javascript">
var mychar = document.getElementById("con");
document.write("原标题:"+mychar.innerHTML+<br>);
mychar.innerHTML = "HelloWorld";
document.write("修改后的标题:"+mychar.innerHTML);
</script>
</body>
只输出了
JavaScript
HelloWorld
两处小问题