<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<style>
button {background-color:#0f0;}
</style>
</head>
<body>
<button id=button> 按钮 </button>
<input type=text>
[removed]
var button = document.getElementById(button);
button.onclick = function() {
alert(this.id); // 弹出button
};
//可以看出上下文的t