Ext消息提示框,显示几秒后自动消失

封装一个Ext消息提示框,显示几秒后自动消失

分类: Ext 2009-12-23 22:11 2842人阅读 评论(4) 收藏 举报

最近项目需要,封装了一个Ext消息提示框,提示信息显示几秒后就自动消失。

css代码:

view plaincopy to clipboardprint?

.msg .x-box-mc {

font-size:14px;

}

#msg-div {

position:absolute;

left:650px;

top:410px;

width:600px;

z-index:20000;

}

.msg-close{

width:10px; height:10px; position:absolute; top:1px; right:10px;cursor:hand;

}

.msg-h3 {

font-size:13px;

color:#2870b2;

font-weight:bold;

margin:10px 0;

}

js代码:

view plaincopy to clipboardprint?

/**

*信息提示框,显示后迅速消失

*/

Ext.QuickMsg = function(){

var msgCt;

function createBox(t, s,isClose){

var html = new Array();

html.push('

');

html.push('

');

html.push('

');

html.push('

');

if(t){

html.push('

');

html.push(t);

html.push('');

}

if(isClose){

html.push('');

}

html.push(s);

html.push('

');

html.push('

');

html.push('

');

return html.join('');

}

return {

/**

* 显示信息

* title:标题

* msg:提示信息

* time:显示时间,超时后自动消失

* alignEl:对齐到该对象的左下角

* offsets[Array]:横向偏移像素,比如:[200,0]标识右移200个像素

* positon:动画

* animate[boolean]:是否开启动画

* isClose[boolean]:是否可关闭

*/

show : function(title, msg, width, time, alignEl, offsets, position,animate,isClose){

width = width?width:'250px';

time = time?time:2;

alignEl = alignEl?alignEl:document;

//alert(alignEl.id);

position = position?position:'t-t';

animate = animate?animate:false;

this.close();

if(!msgCt){

msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);

msgCt.setWidth(width);

}

//采用默认动画将div的最中央对齐到alignEl的左下角,并右移200个象素,且不能超出窗口

msgCt.alignTo(alignEl, position,offsets,animate);

var m = Ext.DomHelper.append(msgCt, {html:createBox(title, msg,isClose)}, true);

m.slideIn('t').pause(time).ghost("t", {remove:true});//元素从上滑入效果,可不带参数调用下同

},

//提示信息

alert : function(msg,field,alignEl,width){

width = width?width:'150px';

var html = ''+msg+'';

this.show('',html,'150px',2,field,[120,0],'t-t',true,false);

},

close: function(){

var div = document.getElementById('msg-div');

if(div){

div.style.display = 'none';

}

msgCt = '';

}

};

}();

封装一个Ext消息提示框,显示几秒后自动消失

分类: Ext 2009-12-23 22:11 2842人阅读 评论(4) 收藏 举报

最近项目需要,封装了一个Ext消息提示框,提示信息显示几秒后就自动消失。

css代码:

view plaincopy to clipboardprint?

.msg .x-box-mc {

font-size:14px;

}

#msg-div {

position:absolute;

left:650px;

top:410px;

width:600px;

z-index:20000;

}

.msg-close{

width:10px; height:10px; position:absolute; top:1px; right:10px;cursor:hand;

}

.msg-h3 {

font-size:13px;

color:#2870b2;

font-weight:bold;

margin:10px 0;

}

js代码:

view plaincopy to clipboardprint?

/**

*信息提示框,显示后迅速消失

*/

Ext.QuickMsg = function(){

var msgCt;

function createBox(t, s,isClose){

var html = new Array();

html.push('

');

html.push('

');

html.push('

');

html.push('

');

if(t){

html.push('

');

html.push(t);

html.push('');

}

if(isClose){

html.push('');

}

html.push(s);

html.push('

');

html.push('

');

html.push('

');

return html.join('');

}

return {

/**

* 显示信息

* title:标题

* msg:提示信息

* time:显示时间,超时后自动消失

* alignEl:对齐到该对象的左下角

* offsets[Array]:横向偏移像素,比如:[200,0]标识右移200个像素

* positon:动画

* animate[boolean]:是否开启动画

* isClose[boolean]:是否可关闭

*/

show : function(title, msg, width, time, alignEl, offsets, position,animate,isClose){

width = width?width:'250px';

time = time?time:2;

alignEl = alignEl?alignEl:document;

//alert(alignEl.id);

position = position?position:'t-t';

animate = animate?animate:false;

this.close();

if(!msgCt){

msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);

msgCt.setWidth(width);

}

//采用默认动画将div的最中央对齐到alignEl的左下角,并右移200个象素,且不能超出窗口

msgCt.alignTo(alignEl, position,offsets,animate);

var m = Ext.DomHelper.append(msgCt, {html:createBox(title, msg,isClose)}, true);

m.slideIn('t').pause(time).ghost("t", {remove:true});//元素从上滑入效果,可不带参数调用下同

},

//提示信息

alert : function(msg,field,alignEl,width){

width = width?width:'150px';

var html = ''+msg+'';

this.show('',html,'150px',2,field,[120,0],'t-t',true,false);

},

close: function(){

var div = document.getElementById('msg-div');

if(div){

div.style.display = 'none';

}

msgCt = '';

}

};

}();


相关内容

  • 示波器说明书(新)
  • HANGZHOU JINGCE 1 安 全 性 使用者应对以下安全性预防措施充分了解,以避免受伤并防止损坏本产品及与其相连接的任何产品. 1.使用正确的电源线,本产品通过电源线的接地导体接地,以免电击,在使用本产品前务必将本产品正确接地. 2.正确连接探极,探极地线与地电势相同,切勿将地线连接至高电 ...

  • 示波器实验一
  • 实验题目:泰克TDS1002数字示波器的使用报告 姓 名:冉 杰 文 学 号: 2012213624 一.实验目的 1.了解示波器的基本结构和工作原理,巩固在理论上学习的示波器的知识. 2.熟悉示波器的面板及每个按钮的功能和作用,熟练运用示波器. 3.学会使用数字示波器测量各种电压信号波形,熟练读取 ...

  • 扩大手机运行内存
  • A.系统自带的app2sd不给力,许多应用无法装到卡上: B.装到卡上应用多了,担心运行速度慢,怕影响手机性能!„„ 一.将SD卡进行分区 因为android系统是基于linux内核的手机系统,只支持linux特有的系统 分区ext分区安装应用程序,所以我们需要对sd卡进行分区,一个ext分区, 一 ...

  • 装软件不占手机内存方法
  • 以前总是装了二十个软件就提示内存不足,用的还是4.0大内存基带,伤不起呀,你的小黄是不是也这样?现在好了,用这个方法可以让你的小黄跟我的一样,装软件丝毫不占用手机内存.费话不多说了,没教程说个j8(任何系统任何机型都可以用这个方法,前提是要有root) 第一步:给你的内存卡分区 进入recovery ...

  • 安卓系统手机软件安装位置改变方法
  • 安卓系统手机软件安装位置改变方法 随着谷歌安卓系统手机越来越多人使用,安卓的一些小问题也被越来越多的人关注,其中最让手机用户头痛的莫过于安卓系统手机默认只能把软件安装在手机内存里,使本来就不大的手机内存显得捉襟见肘.如果你也是个手机软件狂人,喜欢尝试各种各样新奇有趣的软件,面对越来越少的手机内存空间 ...

  • 电磁流量计说明书
  • 上海彪正实业有限公司 HXLDE型智能电磁流量计 说 明 书 上海彪正实业有限公司 目录 一.概述 二.主要技术参数 三.电磁流量计选型编码 四.电磁流量计选型说明 五.流量计接线 六.流量计参数设置 七.流量计自诊断信息与故障处理 八.附录 HXLDE型智能电磁流量计是我公司采用国内外最先进技术研 ...

  • 人力资源绩效考核系统开发与设计
  • 毕业设计 题 目 人力资源绩效考核系统开发与设计 英文题目 学生姓名: 学 号: 专 业: 信息管理与信息系统 院 系: 数学与信息管理系 指导教师: 职称: 教授 二零一一年六月 了解其知识和能力结构,优势和劣势,需要什么,缺少什么.同时,绩效考核也 是判断培训效果的主要手段. 4.绩效考核是确定 ...

  • 手机密码所有解锁方法
  • 手机密码所有解锁方法, 不用在去手机店了 解话机锁:*2767*2878#/*2767*7377# 三星码片复位:*2767*3855# 也可用于解机锁或卡锁 三星显温度.电池容量:*#0228# 三星调显示屏对比度:*#0523# 三星软件版本:*#9999# 三星A100-A188看版本:*#0 ...

  • 汽车停车场停车位显示系统的设计
  • 通信工程专业 计算机类课程设计 题 目 汽车停车场停车位显示系统的设计 学生姓名 索 芳 学号 1013024069 所在院(系) 物 理 与 电 信 工 程 学 院 专业班级 通 信 工 程 103 班 指导教师 陈 正 涛 完成地点 陕西理工学院物理与电信工程学院实验室 2013年 11 月 2 ...