日期:2014-05-16 浏览次数:20695 次
Ext.ux.suggest = function(){ var msgCt; function createBox(t, s){ return ['<div class="msg">', '<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>', '<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><font color=red><h2>', t, '</h2></font>', s, '</div></div></div>', '<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>', '</div>'].join(''); } return { show : function(title, format, pau){ if(!msgCt){ msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true); } if(!pau) pau = 3; var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1)); var m = Ext.DomHelper.append(msgCt, {html: createBox(title, s)}, true); m.slideIn('t').pause(pau).ghost("t", {remove: true}); }, mask: function(id, title){ var el = Ext.get(id); return { show: function(s){ el.mask(s || title, 'x-mask-loading'); }, hide: function(){ el.unmask(); }, destroy: function(){} }; } }; }(); /** * 重写、扩展Ext.MessageBox某些方法 * @author davi */ Ext.apply(Ext.MessageBox, { msgBox: function(ico, title, msg, fn, scope){ this.show({ title : title, msg : '<br>' + msg, buttons: this.OK, fn: fn, scope : scope, icon: ico }); return this; }, //信息 info : function(msg, fn, scope){ return this.msgBox(this.INFO, '信息', msg, fn, scope); }, //问题 quest : function(msg, fn, scope){ return this.msgBox(this.QUESTION, '问题', msg, fn, scope); }, //警告 warn : function(msg, fn, scope){ return this.msgBox(this.WARNING, '警告', msg, fn, scope); }, //错误 error : function(msg, fn, scope){ return this.msgBox(this.ERROR, '错误', msg, fn, scope); }, //提示 cfm : function(msg, fn, scope){ var msg = '<br>' + msg; return this.confirm('提示', msg, fn, scope); }, mask: function(el, title){ return Ext.ux.suggest.mask(el, title); }, //右上角提示 suggest: Ext.ux.suggest.show, //自定义提示 throwOut: function(type,title,msg, format, pau){ if(type=='suggest') this.suggest(title,msg, format, pau) else if (type=='alert') return this.alert(title,msg,format,pau); } }); var Msg = Ext.MessageBox;
------解决方案--------------------
new Ext.ToolTip({ target: 'passwordId',//显示在password的地方 html: 'Click the X to close me', title: 'My Tip Title', autoHide: false, autoShow: true, closable: true, dr