0
function test() {
this.str = "hello";
this.sayHello = function() {
document.write(this.str);
}
this.init = function() {
document.onkeydown = this.sayHello;
}
}
var testing = new test();
testing.init();
위 코드는 onkeydown 이벤트에 "hello"를 출력해야합니다. 하지만 "정의되지 않음"입니다. 어떻게 작동시킬 수 있습니까?이벤트로 객체 변수 얻기
정확히 내가 무엇을 찾고 있었는지. 고마워요! –