<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function ui(){
this.we=function(){
alert("wed");
}
this.test=function(e){
var t=e.which
this.we();
}
this.run=function(){
document.onkeydown=this.test;
}
}
function op(){
var r=new ui();
r.run();
}
op();
</script>
</body>
</html>
你那样给document绑定方法,this对象指向document,不是op的实例
this.run = function () {
var me = this///
document.onkeydown = function (e) { me.test(e) }///
}
貌似是this.porperty.we