Jqueryを使用できる場合は、以下のコードを試してください。これにより、要件に応じてコードを動作させることができます。 JavaScriptで
関数の定義:
<div id="confirmboxpopup" class="confirmboxpopup" style="display: none"></div>
<div id="confirmbox" class="confirm_message">
<div id="confirmboxtitle" class="title"></div>
<div id="confirmboxmessage" class="message"></div>
<div id="confirmbuttons" style="float: right; padding-top: 7px">
<button id="confirmboxok" type="button">ok</button>
<button id="confirmboxcancel" type="button">cancel</button>
</div>
</div>
呼び出す機能:
<script>
function ConfirmMessage(title, message) {
$('#confirmboxpopup').fadeIn(500, function() {
$('#confirmbox').animate({ 'top': '100px' }, 50);
});
$('#confirmboxtitle').html(title);
$('#confirmboxmessage').html(message);
$('#confirmbox').show(50);
$('#confirmboxok').attr('onclick', okFunction());
$('#confirmboxcancel').attr('onclick', onCancelClickFunction());
}
function okFunction()
{
'enter code here to implement next step if user agree'
}
function onCancelClickFunction()
{
'enter code here to fadeout for id #confirmboxpopup to remove popup.'
}
</script>
はidを持つHTMLのタグを定義 あなただけのようなパラメータでConfirmMessageを呼び出す必要があります「ConfirmMessage(タイトル、メッセージ) "
私はちょうどjQuery-UIダイアログか代替を使用します。組み込みの確認/警告ボックスから移動します。あなたはこのように多くの機能を得るでしょう。 –