双标签中的内容,包括文本和所有尖括号的标签都属于innerHTML。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>innerHTML</title>
<meta name="keywords" content="关键字列表" />
<meta name="description" content="网页描述" />
<link rel="stylesheet" type="text/css" href="" />
<style type="text/css">
#d1{
background-color:red;
height:300px;
color:blue;
cursor:crosshair; /* 表示鼠标的形状 */
}
</style>
<script type="text/javascript">
function xianshi(){
var m=document.getElementById("d1");
//m.innerHTML="你好";
var str=m.innerHTML;
alert(str);
}
</script>
</head>
<body>
<div id="d1" οnclick="xianshi()">
<div>
这是汉字
<p>这是段落</p>
<u>abc</u>
<a href="#">连接</a>
</div>
</div>
<div>
</div>
</body>
</html>