web开发中经常需要用用js来模拟 windows的窗口,所以就开发了一个XWindows的javascript类。demo演示效果如下:用mootools做为基础类库。本来打算把状态控制改写成状态模式,不过暂时没有兴趣了:) 源代码贴点: XWindowStatus = new Class( ... { //status's manager isMax : false, isMin : false, isNormal: false, father : null, initialize : function(father)...{ this.father = father; }, setMax : function()...{ this.isMin = false; this.isNormal = false; this.isMax = true; this.setIconState(); }, setMin : function()...{ this.isMin = true; this.isNormal = false; this.isMax = false; this.setIconState(); }, setNormal: function()...{ this.isMin = false; this.isNormal =true; this.isMax = false; this.setIconState(); }, setIconState: function()...{ //reset this.father.iconMax.className = 'icon_max'; this.father.iconMin.className = 'icon_min'; //set switch (true) ...{ case this.isMin: this.father.iconMin.className = 'icon_revert'; break; case this.isMax: this.father.iconMax.className = 'icon_revert'; break; } } } ); XWindow