0
이 이벤트가 작동하지 않는 이유를 이해할 수 없습니다. "P"는 내 객체와의 onclick이 이벤트 일이다 그러나 결코 때 onKeyPress으로, onKeyDown에 등 ...Onkeypress가 키와 함께 작동하지 않습니다.
<rect width="20" height="100" x="900" y="195" onkeypress="p.moverpala(evt)" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
moverpala(evt) {
this.x = evt.keyCode;
if (this.x == 37) {
console.log("You pressed the left arrow!");
}
}
사용자가 요소를 직접 클릭 할 수 있으므로 onclick이 작동하지만 그 요소가 키보드 포커스를 얻는 방법은 무엇입니까? – nnnnnn
도움을 주셔서 대단히 감사합니다. – FranRP