<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>document.getElementById</title>
</head>
<body>
<p id="con">JavaScript</p>
<script type="text/javascript">
var mychar=document.getElementById("con")
document.write("结果:"+mychar); //输出获取的P标签。
</script>
</body>
</html>
document.getElementById('con')获取的只是P标签(即对象,这里是P标签),返回的是[object HTMLParagraphElement],document.getElementById('con').innerHTML获取的才是P标签里的内容,返回的是JavaScript