欢迎来到天天文库
浏览记录
ID:14079580
大小:95.00 KB
页数:7页
时间:2018-07-25
《04第四讲信息提示框组件》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、第四讲EXT的信息提示框组件1.Ext.MessageBox.alert()方法标准提示框APIalert(Stringtitle,Stringmsg,Functionfn,Objectscope):Ext.MessageBox参数项:title:StringThetitlebartextmsg:StringThemessageboxbodytextfn:Function(optional)Thecallbackfunctioninvokedafterthemessageboxisclosedscope:Object(optional
2、)Thescopeofthecallbackfunction有四个参数,我们这里主要介绍前面三个。title,标题,必选msg,本体文本,必选fn,在关闭弹出窗口后触发该函数,可选。示例一:Ext.onReady(functionTestMessageBox(){//声明函数的方式Ext.MessageBox.alert("测试","弹出提示框");});添加事件处理Ext.onReady(functionTestMessageBox(){Ext.MessageBox.alert("测试","弹出对话框",function(){doc
3、ument.write("关闭对话框");//在页面上直接的书写});});对按钮之进行判断Ext.onReady(functionTestMessageBox(){Ext.MessageBox.alert("测试","弹出对话框",function(e){if(e=='ok'){//此种判断价值不高document.write("单击了确定按钮");}elseif(e=='cancel'){document.write("单击了关闭按钮");}});});与页面的组件绑定使用页面上创建按钮组件4、puttype="button"value="点击出现对话狂"id="btn">Ext.onReady(function(){Ext.get("btn").on("click",function(){Ext.MessageBox.alert("提示","这是标准的信息的弹出");//Message的弹出包含两个message,第一是title第二是内容//Ext.Msg.alert("另外方式的弹出")});});2.Ext.MessageBox.confirm()方法确认对话框APIconfirm(Stringtitle,Strin5、gmsg,Functionfn,Objectscope):Ext.MessageBox参数项:title:StringThetitlebartextmsg:StringThemessageboxbodytextfn:Function(optional)Thecallbackfunctioninvokedafterthemessageboxisclosedscope:Object(optional)Thescopeofthecallbackfunction参数和alert方法一样。示例二:Ext.onReady(functionTest6、MessageBox(){Ext.MessageBox.confirm("保存","是否保存文件");});添加事件处理。Ext.onReady(functionTestMessageBox(){Ext.MessageBox.confirm("保存","是否保存文件",function(e){document.write(e);});});对按钮值进行判断。Ext.onReady(functionTestMessageBox(){Ext.MessageBox.confirm("保存","是否保存文件",function(e){if(e7、=='yes'){document.write("保存文件");}elseif(e=='no'){document.write("不保存文件");}});});与页面的元素绑定Ext.get("btnConfirm").on("click",function(){Ext.Msg.confirm("请确认","是否要删除该记录",function(button,text){//该函数为回调函数,可8、以包含两个参数/***button:点击的按钮*text:有活动时输入选项时输入的内容*/if(button=="yes"){//注意比较的字符串的书写Ext.MessageBox.alert("提示","操作已经执行!
4、puttype="button"value="点击出现对话狂"id="btn">Ext.onReady(function(){Ext.get("btn").on("click",function(){Ext.MessageBox.alert("提示","这是标准的信息的弹出");//Message的弹出包含两个message,第一是title第二是内容//Ext.Msg.alert("另外方式的弹出")});});2.Ext.MessageBox.confirm()方法确认对话框APIconfirm(Stringtitle,Strin
5、gmsg,Functionfn,Objectscope):Ext.MessageBox参数项:title:StringThetitlebartextmsg:StringThemessageboxbodytextfn:Function(optional)Thecallbackfunctioninvokedafterthemessageboxisclosedscope:Object(optional)Thescopeofthecallbackfunction参数和alert方法一样。示例二:Ext.onReady(functionTest
6、MessageBox(){Ext.MessageBox.confirm("保存","是否保存文件");});添加事件处理。Ext.onReady(functionTestMessageBox(){Ext.MessageBox.confirm("保存","是否保存文件",function(e){document.write(e);});});对按钮值进行判断。Ext.onReady(functionTestMessageBox(){Ext.MessageBox.confirm("保存","是否保存文件",function(e){if(e
7、=='yes'){document.write("保存文件");}elseif(e=='no'){document.write("不保存文件");}});});与页面的元素绑定Ext.get("btnConfirm").on("click",function(){Ext.Msg.confirm("请确认","是否要删除该记录",function(button,text){//该函数为回调函数,可
8、以包含两个参数/***button:点击的按钮*text:有活动时输入选项时输入的内容*/if(button=="yes"){//注意比较的字符串的书写Ext.MessageBox.alert("提示","操作已经执行!
此文档下载收益归作者所有