this 是 JavaScript 语言的一个关键字,代表函数运行时,自动生成的一个内部对象。this 指向当前函数体的父级对象。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<button id="dv"> 测试 </button>
</body>
<script type="text/javascript">
document.getElementById("dv").onclick=function(){
// alert(this.innerHTML);
tp();
}
function tp(){
alert(this);
}
</script>
</html>