Ext.onReady(function(){ //定义内容 var people = {"name":"admin","age":25,"sex":"女"}; var str = people.name+":<span style='color:red;margin:0 10px;'>"+people.age+"</span>:"+people.sex; //回调函数 function callback(id,msg){ Ext.Msg.msgButtons['ok'].setText("00s011"); console.info("点击ID:"+id+":"+msg); } //Ext.Msg.alert("我的信息",str,callback); //Ext.Msg.confirm("我的信息",str,callback); //Ext.Msg.prompt('我的信息介绍', '填写一下姓名:',callback,this,false,"请填写姓名以及介绍:"); //以上方法都默认调用的是show函数,show函数能够自定义配置 Ext.Msg.show({ title : '显示信息', msg : str, modal : true, prompt : true, value : '请输入', fn : callback, buttons : Ext.Msg.YESNOCANCEL, icon : Ext.Msg.QUESTION }); //更新时钟 /*var myBox = Ext.Msg.show({ title : '时钟', msg : "动态更新文字", modal :true, buttons : Ext.Msg.OK, fn : function(){ Ext.TaskManager.stop(s); } }); var s = { run : function(){ myBox.updateText("会动的时间:"+Ext.util.Format.date(new Date(),'Y-m-d g:i:s A')); }, interval : 1000 }; Ext.TaskManager.start(s);*/ //动态更新进度条progress var msgBox = Ext.Msg.show({ title : '提示', msg : '动态更新进度条', modal :true, width : 300, progress : true }); var count = 0; //滚动条被刷新的次数 var percentage = 0; //进度百分比 var progressText = ""; //进度条信息 var task ={ run : function(){ count++; //计算进度 percentage = count/10; //生成进度条文字 progressText = "当前进度:"+percentage*100+"%"; //更新信息提示 msgBox.updateProgress(percentage,progressText,"当前时间:"+Ext.util.Format.date(new Date(),'Y-m-d g:i:s A')); //刷新10次后关闭提示框 if(count>10){ Ext.TaskManager.stop(task); msgBox.hide(); } }, interval : 1000 }; Ext.TaskManager.start(task); });