<html>
<head>
<title>访问HTML元素的内容</title>
<script language="JavaScript">
function changeText(){
   myH2.innerText = "更改文字内容";
}
function changeHTML(){
   myH2.innerHTML = "<marquee>更改标签内容</marguee>"
}
function showContent1(){
   alert(myP.innerText + "\n" + myP.innerHTML);
}
function showContent2(){
   alert(myP.outerText + "\n" + myP.outerHTML);
}
</script>
</head>
<body id="myBody">
<h2 id="myH2">访问HTML元素的内容</h2>
<hr>
<p id="myP">访问<i id="myI">HTML</i><b>元素</b>的内容</p>
<form>
<input type="button" onclick="changeText()" value="更改文字内容">
<input type="button" onclick="changeHTML()" value="更改标签内容">
<input type="button" onclick="showContent1()" value="显示Inner元素内容">
<input type="button" onclick="myI.outerText='CSS';" value="取代文字内容">
<input type="button" onclick="showContent2()" value="显示Outer元素内容">
</form>
</body>
</html>