<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
#div1{
background-color: #0077AA;
height:100px;
width:200px;
}
</style>
<script>
function demo1(){
//获得div1对象
var div = document.getElementById("div1");
//获得元素的文本内容
var inn = divinnerHTML;
var inn2 = divinnerText;
console.log(inn);
console.log(inn2);
//会识别HTML信息
div.innerHTML = "<h1>这里面不一样好</h1>"
}
</script>
</head>
<body>
<div id = "div1">这里面不一样</div>
<input type = "button" value = "点击" onlock = "demo1()"/>
</body>
</html>