2010-05-21 4 views
4

ASP.NET MVC 페이지 (등록)가 있습니다. 페이지를로드하는 중, 나는 대화 상자에 Agree동의 안 함 단추를 사용하여 Jquery Dialog를 호출합니다.ASP.NET MVC 페이지에서 JQuery Dialog 단추 중 하나에 포커스를 얻으려면?

1). 포커스를 동의 단추에 포커스를 설정하는 방법

2). X (닫기)이 오른쪽 상단 구석에 표시되어 있지 않도록 설정하는 방법? (그래서 나는 사용자가 그 대화를 간단하게 닫는 것을 원치 않는다.)

코드 :

$("#dialog-confirm").dialog({ 
     closeOnEscape: false, 
     autoOpen: <%= ViewData["autoOpen"] %>, 
     height: 400, 
     width: 550, 
     modal: true, 
     buttons: { 
      'Disagree': function() { 
       location.href = "/"; 
      }, 
      'Agree': function() { 
       $(this).dialog('close'); 
       $(this).focus(); 
      } 
     }, 
     beforeclose: function(event, ui) { 
      var i = event.target.id; 
      var j = 0; 
     } 
    });   

당신의 응답을 주셔서 감사합니다.

$("#dialog-confirm").dialog({ 

    open: function(event, ui) { 

      $(".ui-dialog-titlebar-close").hide(); // Hide the [x] button 

      $(":button:contains('Ok')").focus(); // Set focus to the [Ok] button 
    } 

}); 
:

감사

답변

10

나는 이것을 사용
관련 문제