사용자의 응답을 확인하기 위해 .net 프로젝트에서 사용하는 jQuery가 팝업되는 예/아니요 확인 창을 만드는 기능을 만들었습니다. 클릭 한 항목에 따라 기능을 트리거하는 버튼을 생성했습니다.동적 내용이 포함 된 jQuery 모달 팝업 창에 keydown 이벤트 추가
//은 (TitleKey이 InstructionsKey, YesFunction, 된 nofunction) {
//create the service to give us the content
var agpc = new AjaxServices.AjaxPopUps();
//get the results and open the popup with the functions aligned
agpc.GetLocalizedStrings(new Array(TitleKey, InstructionsKey, "Yes", "No"), function (results) {
var content = jQuery.parseJSON(results.toString());
//get the buttons for confirm/or not
var YesNoButtons = jQuery('<div></div>', { id: 'YesNoButtons' });
var yesButton = jQuery('<a>' + content.Yes + '</a>');
var noButton = jQuery('<a>' + content.No + '</a>');
//add the event handlers
yesButton.click(YesFunction);
noButton.click(NoFunction);
//set a nice pointer for mouse over
yesButton.css({ cursor: 'pointer' });
noButton.css({ cursor: 'pointer' });
YesNoButtons.append(yesButton).append(noButton);
//show the box
openPopup("Non-JSON", YesNoButtons, eval('content.' + TitleKey), eval('content.' + InstructionsKey));
});
}
그럼 이제 어려운 부분을 제공 지역화 된 방식으로 기능 popupConfirm 물건을 확인하는 specailized 팝업을로드합니다. 회사는 또한 키 누르기가 예/아니오 기능을 트리거하기를 원합니다. 엔터 키는 예를 트리거하고 이탈은 아니오를 트리거합니다. 나는이 타입의 셋업으로 이것을 어떻게 할 것인지 전혀 모른다.
대부분의 코드는 무시해도됩니다. 서버에서 지역화 된 문자열을 가져 오는 것입니다. 그것은 내가 알 수없는 keydown() 이벤트를 추가하는 것입니다.
아이디어가 있으십니까?