<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>this的典型应用</title>
</head>
<body>
<!--
(1)在html元素事件属性中使用,如:
<input type=”button” onclick=”showInfo(this);” value=”点击一下”/>
(2)构造函数
function Animal(name, color) {
this.name = name;
this.color = color;
}
(3)这里this是按钮
<input type="button" id="text" value="点击一下"/>
<script>
var btn = document.getElementById("text");
btn.onclick = function () {
alert(this.value);
}
</script>
-->
</body>
</html>