사용자가 키보드의 키를 누를 때 누구도 생성 된 Ajax.ActionLink를 실행할 수 있습니까? (이것은 접근성에 필요)ASP.NET MVC Ajax - 키보드 입력으로 -GENERATED-Ajax 링크를 실행할 수 있습니까?
참고 : 나는 ASP.NET MVC + 마이크로 소프트 JS 라이브러리를 사용하고 있습니다 (...은 ajax.js/... MvcAjax.js) + jQuery를
자바 스크립트의 키 (IE + 파이어 폭스)
$(document).keypress(function(event) {
if(event.keyCode == 27) {
//execution here
var a = document.getElementById('linkid');
}
});
HTML을 ASP.NET MVC에 의해 생성 된 (Ajax.ActionLink())
를 캡처다음은 내가 찾고있는 것이 아니며, 작동하지 않습니다!
$(document).keypress(function(event) {
if(event.keyCode == 27) {
var a = document.getElementById('linkid');
a.onclick(); //doesn't exist in Firefox
a.click(); //doesn't "work" in Firefox (reference to "this" [a] is needed .NET MVC javascript)
a["onclick"](); //same as .onclick()
a["click"](); //same as .click()
//or even:
a.onclick.apply(a); //doesn't exist in Firefox
a.click.apply(a); //Somehow keeps "this" reference, but throws Sys.ArgumentUndefinedException
}
});
아이쿠, 나는 jQuery를 부분을 시도하지 않았습니다. 나는 그것이 실제로 작동하게 할 것 같아요. 두 번째 부분 : AJAX와 non-AJAX 요청에 대한 핸들러를 만들었지 만, 인트라넷이기 때문에 (IE7) 나 (FF)는 AJAX와 협력해야합니다. 특히 키보드 입력을 사용해야합니다. 나는 내일 jQuery 파트를 다음번에 시험해 볼 것이다. – Ropstah
잘 potverdrie, 그것은 작동합니다! :) – Ropstah