在extjs包中exampls/shared/examples.js中
Ext.example = function(){
var msgCt;function createBox(t, s){
return '<div class="msg"><h3>' + t + '</h3><p>' + s + '</p></div>';
}
return {
msg : function(title, format){
if(!msgCt){
msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
}
var s = Ext.String.format.apply(String, Array.prototype.slice.call(arguments, 1));
var m = Ext.DomHelper.append(msgCt, createBox(title, s), true);
m.hide();
m.slideIn('t').ghost("t", { delay: 1000, remove: true});
},
init : function(){
if(!msgCt){
// It's better to create the msg-div here in order to avoid re-layouts
// later that could interfere with the HtmlEditor and reset its iFrame.
msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
}
}
};
}();
本文介绍了一个用于ExtJS框架的消息显示组件实现细节。该组件能够创建并显示带有标题和内容的消息框,通过滑动动画展示并设置延迟后自动移除。文章还提供了初始化组件的方法。
565

被折叠的 条评论
为什么被折叠?



