注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

回忆之旅

我很向往山村的农庄生活,他们的热情,让我无法抗拒! 51EOO.COM

 
 
 

日志

 
 

Asp.net +javascript 弹出Div层  

2010-01-03 09:31:59|  分类: 技术分享 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

    //对象,宽,高
    function ShowWindow(obj,obj1,obj2){
        var panel=document.getElementById(obj);
        var cwidth = document.documentElement.clientWidth;
        var cheight = document.documentElement.clientHeight;
        var pwidht=parseInt(panel.style.width);
        var pheight=parseInt(panel.style.height);
        var moveX = 0;
        var moveY = 0;
        var moveTop = 0;
        var moveLeft = 0;
        var moveable = false;
        var docMouseMoveEvent = document.onmousemove;
        var docMouseUpEvent = document.onmouseup;
       
        var bgObj = document.createElement("div");
        bgObj.id='back';
        document.body.appendChild(bgObj);        
        var i=3;
        bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:"+cwidth+"px;height:"+cheight+"px;filter:Alpha(Opacity="+i*10+");opacity:"+i/10+";background-color:#000000;z-index:0;";
        document.body.cssText=bgObj;
       
    with(panel.style){
    left=((cwidth-pwidht)/2)+"px";
    top=((cheight-pheight)/2)+"px";
    position='absolute';
    filter='Alpha(Opacity=100)';
    opacity='1';
    }
        panel.style.display='block';

        panel.onmousedown=function(){
                var evt = GetBrowseEvent();
                moveable = true;
                moveX = evt.clientX;
                moveY = evt.clientY;
                moveTop = parseInt(panel.style.top);
                moveLeft = parseInt(panel.style.left);
               
                document.onmousemove = function() {
                        if (moveable) {
                                var evt = GetBrowseEvent();
                                var x = moveLeft + evt.clientX - moveX;
                                var y = moveTop + evt.clientY - moveY;
                                if ( x > 0 &&( x + obj1 < cwidth) && y > 0 && (y + obj2 < cheight) ) {
                                with(panel.style){
                                        left = x + "px";
                                        top = y + "px";
                                        filter='Alpha(Opacity=30)';
                                        opacity='0.5';
                                        }
                                }                              
                               
                        }       
                };
               
                document.onmouseup = function () {
                        if (moveable) {
                                document.onmousemove = docMouseMoveEvent;
                                document.onmouseup = docMouseUpEvent;
                                moveable = false;
                                moveX = 0;
                                moveY = 0;
                                moveTop = 0;
                                moveLeft = 0;
                                with(panel.style){
                                filter='Alpha(Opacity=100)';
                                opacity='1';
                                }
                        }
                };  
              }
   
   
    }
   
    function GetBackGroup(){
   
    }
   
    function GetBrowseEvent() {
            return window.event || arguments.callee.caller.arguments[0];
    }
   
    var state;
    function CloseWindow(obj){   
    document.getElementById(obj).style.display='none';
    if(document.getElementById('back')!=null)
    {
        document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
    } 
    }   

    function CloseWindows(obj,end){
    if (end>0){
    with(document.getElementById(obj).style){
    filter='Alpha(Opacity='+end+')';
    opacity=''+end/10+'';
    }
    state= setTimeout(CloseWindows(obj,end-1),100);
    }else{   
    end=0;
    clearInterval(state);

    }
    }
   



Asp.net +javascript 弹出Div层 - Tony - 回忆之旅
  评论这张
 
阅读(410)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017