原创 [原创] PopUp特效收藏

新一篇: 图形按钮『HTC封装』 | 旧一篇: RecordSet四种游标类型

/*
    格式:set oPopUp = new PopUp(strHTML,Speed,Width,Height,Left,Top)
    参数说明:    strHTML        弹出窗口的HTML内容
                Speed        MSN和BOOM方式弹出的速度,1为最快
                Width        弹出窗口的宽度
                Height        弹出窗口的高度
                Left/Top    弹出窗口的位置
    以上参数要按顺序填写,可以省略最后的参数,或者全部不填
    相对应的属性可以用PopUpWindow.HTML,PopUpWindow.Speed,PopUpWindow.Width ....来设置
*/

function ClassPopUp (){
    this.HTML="";
    this.Speed=1;        //显示速度,现在已经是最快了
    this.Width=100;
    this.Height=100;
    this.Left=100;
    this.Top=100;
    this.m_PopUp=window.createPopup();
    if(arguments.length>0)    this.HTML=arguments[0];
    if(arguments.length>1)    this.Speed=parseInt(arguments[1]);
    if(arguments.length>2)    this.Width=parseInt(arguments[2]);
    if(arguments.length>3)    this.Height=parseInt(arguments[3]);
    if(arguments.length>4)    this.Left=parseInt(arguments[4]);
    if(arguments.length>5)    this.Top=parseInt(arguments[5]);
    with(this.m_PopUp.document.body.style){
        border="none";
        backgroundColor="white";
        padding="0px";
        margin="0px";
        fontSize="12px";
    }
}
//////////////////////////////////////
var PopUpWindow=new ClassPopUp();    //    全局变量 所有的弹出窗口都公用对象
var m_Left=0;                        //全局变量:当前x位置
var m_Top=0;                        //全局变量:当前y位置
var m_Width=0;                        //全局变量:屏幕宽度
var m_Height=0;                        //全局变量:当前高度
var m_sWidth=screen.width;            //全局变量:屏幕宽度
var m_sHeight=screen.height;        //全局变量:屏幕高度
var m_Timer=null;                    //全局变量:定时器
var m_Showing=false;                //全局变量:正在显示
//直接显示
//调用方式:DirectShowPopUp();
function DirectShowPopUp(){
    PopUpWindow.m_PopUp.document.body.innerHTML=PopUpWindow.HTML;
    PopUpWindow.m_PopUp.show(PopUpWindow.Left,PopUpWindow.Top,PopUpWindow.Width,PopUpWindow.Height);
}
/////////////////////////////////////////////
// 象MSN提示窗口一样在右下脚升起
// 调用方式:MSNShowPopUp();
/////////////////////////////////////////////
function MSNShowPopUp(){
    if(!m_Showing){    //初始化
        m_Height=0;
        m_Width=PopUpWindow.Width;
        m_Left=m_sWidth-m_Width-2;
        m_Top=m_sHeight-2;
        PopUpWindow.m_PopUp.document.body.innerHTML=PopUpWindow.HTML;
        m_Showing=true;
        m_Timer=window.setTimeout("MSNShowPopUp()",PopUpWindow.Speed);
    }else{
        if(m_Height<=PopUpWindow.Height){
            PopUpWindow.m_PopUp.show(m_Left,m_Top,m_Width,m_Height);
            m_Height+=5;
            m_Top-=5;
            m_Timer=window.setTimeout("MSNShowPopUp()",PopUpWindow.Speed);
        }else{
            window.clearTimeout(m_Timer);
            m_Showing=false;
            m_Timer=null;
            return;
        }
    }
}
////////////////////////////////////////////
//在屏幕中间从小到大弹出
//调用方式:BoomShowPopUp();
////////////////////////////////////////
function BoomShowPopUp(){
    if(!m_Showing){    //初始化
        m_Width=1;
        m_Height=1;
        m_Left=m_sWidth/2;
        m_Top=m_sHeight/2;
        PopUpWindow.m_PopUp.document.body.innerHTML=PopUpWindow.HTML;
        m_Showing=true;
        m_Timer=window.setTimeout("BoomShowPopUp()",PopUpWindow.Speed);
    }else{
        if(m_Width<=PopUpWindow.Width || m_Height<=PopUpWindow.Height){
            PopUpWindow.m_PopUp.show(m_Left,m_Top,m_Width,m_Height);
            if(m_Width<=PopUpWindow.Width){
                m_Width+=8;
                m_Left-=4;
            }
            if(m_Height<=PopUpWindow.Height){
                m_Height+=8;
                m_Top-=4;
            }
            m_Timer=window.setTimeout("BoomShowPopUp()",PopUpWindow.Speed);
        }else{
            window.clearTimeout(m_Timer);
            m_Showing=false;
            m_TImer=null;
            return;
        }
    }
}

发表于 @ 2004年10月05日 23:36:00|评论(loading...)|编辑

新一篇: 图形按钮『HTC封装』 | 旧一篇: RecordSet四种游标类型

评论

#meme 发表于2006-05-18 09:59:00  IP: 60.0.12.*
这个怎么应用呀
#newlethe 发表于2006-12-01 12:08:00  IP: 61.183.71.*
this.HTML="";
在这里面加链接
this.HTML="<a href=\"http://www.baidu.com\">百度</a>";
好像链接不能点击!!


http://bbs.blueidea.com/thread-2699197-1-1.html
发表评论  


登录
Csdn Blog version 3.1a
Copyright © eglic