Javascript 模拟windows多窗口

本文介绍如何利用JavaScript和MooTools库来模拟Windows操作系统中的多窗口功能。通过一个名为XWindows的JavaScript类,开发者可以实现类似的效果。文章提供了一个demo演示,并展示了部分源代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值