範例如下:
===================================
var config = {
msg: 'Display Time',
modal: true,
buttons: Ext.Msg.OKCANCEL,
fn: displayTime
}
Ext.MessageBox.msgButtons[0].setText('Start');
Ext.MessageBox.msgButtons[3].setText('Stop');
Ext.MessageBox.show(config);
function start_task() {
Ext.MessageBox.updateText('????:' + Ext.util.Format.date(new Date(), 'Y-m-d g:1:s A'));
}
var task = { // moved outside function so it was not called over and over
run: start_task,
scope: this,
interval: 1000
}
function displayTime(id) {
if (id == 'ok') {
// task was here ... was not always defined due to if statement; was also recalled each time
Ext.TaskManager.start(task);
} else {
Ext.MessageBox.updateText('Paused!');
Ext.TaskManager.stop(task);
}
};
============I tried,it works===========================
來源網址在此
大家一起加油吧
沒有留言:
張貼留言