一般使用請參照下列網址

http://alertifyjs.com/

 

在驗證視窗內再增加一個選項…

function test()

{

var Msg =’顯示訊息’;

alertify.myConfirm(Msg)
.set(
{
‘onok’: function()
{
//當使用者按 OK時
},
‘oncontinue’: function()
{

//當使用者按下 Next 時
},
‘oncancel’: function()
{
//當使用者按下取消時
},
‘labels’:
{
‘ok’: ‘確定’,
‘cancel’: ‘取消’
}
}).setHeader(‘<em> 提示訊息 </em> ‘).autoCancel(60); //設定標題 & 倒數觸發取消事件
}

 

 

//以下為設定第三個按鈕

alertify.dialog(‘myConfirm’, function()
{
var settings; return{
setup: function()
{
var settings = alertify.confirm().settings;
for (var prop in settings)
this.settings[prop] = settings[prop];
var setup = alertify.confirm().setup();
setup.buttons.push(
{
text: ‘Next’,
scope: ‘auxiliary’,
});
return setup;
},
settings:
{
oncontinue: null
},
callback: function(closeEvent)
{
if (closeEvent.index == 2)
{
if (typeof this.get(‘oncontinue’) === ‘function’)
{
returnValue = this.get(‘oncontinue’).call(this, closeEvent);
if (typeof returnValue !== ‘undefined’)
{
closeEvent.cancel = !returnValue;
}
}
}
else
{
alertify.confirm().callback.call(this, closeEvent);
}
}
};
}, false, ‘confirm’);

 

Leave a Comment