삭제 확인 대화 상자를 만드는 방법은 무엇입니까? '예'가 메시지를 삭제하면 '아니오'가 삭제 작업을 취소합니다.PHP의 부트 스트랩 확인 대화 상자
현재 내가보기에 다음과 같이 있습니다
<a href="javascript:;" class="btn btn-large btn-info msgbox-confirm">Confirm Message</a>
어떻게 대화 상자의 내용을 변경하는 방법?
삭제 확인 대화 상자를 만드는 방법은 무엇입니까? '예'가 메시지를 삭제하면 '아니오'가 삭제 작업을 취소합니다.PHP의 부트 스트랩 확인 대화 상자
현재 내가보기에 다음과 같이 있습니다
<a href="javascript:;" class="btn btn-large btn-info msgbox-confirm">Confirm Message</a>
어떻게 대화 상자의 내용을 변경하는 방법?
PHP는 서버 측 코드이므로 PHP에서 확인 또는 부트 스트랩 확인을 할 수 없습니다.
다음은 Javascript를 사용하여 확인 상자를 만드는 방법입니다. 이 함수
HTML
<button onclick="show_confirm()">Click me</button>
자바 스크립트
// function : show_confirm()
function show_confirm(){
// build the confirm box
var c=confirm("Are you sure you wish to delete?");
// if true
if (c){
alert("true");
}else{ // if false
alert("false");
}
}
로 버튼을하기 만 것입니다 자바 스크립트 일반 표준을 사용하여
일반 자바 스크립트
부트 스트랩 jQuery를
이 방법으로는 제 3 자 라이브러리에 추가로 좀 더 복잡하다.
시작하려면 확인 상자의 역할을하는 모달을 만들어야합니다.
자바 스크립트
// function : show_confirm()
function show_confirm(){
// shows the modal on button press
$('#confirmModal').modal('show');
}
// function : ok_hit()
function ok_hit(){
// hides the modal
$('#confirmModal').modal('hide');
alert("OK Pressed");
// all of the functions to do with the ok button being pressed would go in here
}
다음
<button class="btn btn-danger" onclick="show_confirm()">Click me</button>
과 스타일링의 작은 비트와 함께 이전
HTML
<div id="confirmModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Delete?</h3>
</div>
<div class="modal-body">
<p>Are you sure you wish to delete?</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button onclick="ok_hit()" class="btn btn-primary">OK</button>
</div>
</div>
같은 버튼
자바 스크립트와 간단한 방법 :
<a onclick="if(!confirm('Are you sure that you want to permanently delete the selected element?'))return false" class="btn btn-large btn-info msgbox-confirm" href="?action=delete">Delete</a>
이 방법을 때 "삭제"에서 사용자가 클릭, 대화 상자가 확인하기 위해 그/그녀를 요청합니다. 그것이 받아 들여지는 경우, 페이지는 url에있는 매개 변수로 다시로드됩니다 (필요한 것으로 변경하십시오). 그렇지 않으면 대화 상자가 닫히고 아무 일도 일어나지 않습니다.
Rober, 위의 이미지로 확인 대화 스타일이 필요하지만 위의 대답은 문제의 절반을 해결합니다 –
<script>
function deletechecked()
{
var answer = confirm("Are you sure that you want to permenantly delete the selected element?")
if (answer){
document.messages.submit();
}
return false;
}
</script>
<a href="<?php echo base_url('department/deletedept/'.$row['dept_id']);?>" onclick="return deletechecked();" title="Delete" data-rel="tooltip" class="btn btn-danger">
난 정말 당신이 무슨 뜻인지 이해가 안 돼요. JS/Jquery를 사용하여 프로세스를 개발하거나 수락/거절하는 방법, 페이지를 다시로드하여 PHP를 사용하는 방법 또는 일반적으로 묻는 중입니까?그리고 "대화 상자 내용 변경"이란 어떤 행동을 의미합니까? 클릭 후 버튼 disappering? – Rober
Robert, Am Just asking, yes를 클릭하면 컨트롤러에서 하나의 메소드를 호출해야한다는 것을 의미하고, no 또는 clicked가 취소되면 아무 것도해서는 안된다는 것을 의미합니다. –
PHP의 확인 대화 상자에 대한이 코드는 내 문제를 해결합니다. '
' 'Delete' –