利用JavaScript弹出div层,以及递归调用

mac2022-06-30  49

function BOX_show(e,obj)//显示{    if(obj<24)        document.cookie = "tdid="+obj;    if(document.getElementById(e)==null)    {        return ;    }    var selects = document.getElementsByTagName('select');    for(i = 0; i < selects.length; i++)    {        selects[i].style.visibility = "";    }

    BOX_layout(e);    window.onresize = function(){BOX_layout(e);} //改变窗体重新调整位置    window.onscroll = function(){BOX_layout(e);} //滚动窗体重新调整位置    document.onkeyup = function(event)    {        var evt = window.event || event;        var code = evt.keyCode?evt.keyCode : evt.which;        //alert(code);

        if(code == 27)        {            BOX_remove(e);        }    }}

function BOX_remove(e)//移除{    window.onscroll = null;    window.onresize = null;    document.getElementById('BOX_overlay').style.display="none";    document.getElementById(e).style.display="none";

    var selects = document.getElementsByTagName('select');    for(i = 0; i < selects.length; i++)    {        selects[i].style.visibility = "visible";    }}

function BOX_layout(e)//调整位置{    var a = document.getElementById(e);

    if (document.getElementById('BOX_overlay')==null)//判断是否新建遮掩层    {

        var overlay = document.createElement("div");        overlay.setAttribute('id','BOX_overlay');        document.body.appendChild(overlay);    }

    document.getElementById('BOX_overlay').οndblclick=function(){BOX_remove(e);};    //取客户端左上坐标,宽,高    var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);    var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);

    var clientWidth;    if (window.innerWidth)    {        clientWidth = window.innerWidth;    }    else    {        clientWidth = document.documentElement.clientWidth;    }

    var clientHeight;    if (window.innerHeight)    {        clientHeight = window.innerHeight;    }    else    {        clientHeight = document.documentElement.clientHeight;    }

    var bo = document.getElementById('BOX_overlay');    bo.style.left = scrollLeft+'px';    bo.style.top = scrollTop+'px';    bo.style.width = clientWidth+'px';    bo.style.height = clientHeight+'px';    bo.style.display="";    //Popup窗口定位    a.style.position = 'absolute';    a.style.zIndex=999;    a.style.display="";}

function HiddenButton(e){    e.style.visibility='hidden';    e.coolcodeviousSibling.style.visibility='visible'}function tanchu(obj)   {if(obj==3){    for(var i=1;i<11;i++)    {    if(i==9)        {            document.getElementById(i).className="style7";            document.getElementById(i).οndblclick=function asdfs(){BOX_show('shortterm',obj)};        }    else if(i==10)    {        document.getElementById(i).className="style7";        document.getElementById(i).οndblclick=function diyi(){BOX_show('updatesource',10)};    }    else    {        document.getElementById(i).className="FGray";        document.getElementById(i).οndblclick="";     }    }}else if(obj==10){    for(var j=1;j<19;j++)    {    if(j > obj)        {            switch(j)            {                case 11:                    document.getElementById(j).className="style7";                    document.getElementById(j).οndblclick=function shiyi(){BOX_show('buysource',obj)};                    break;                case 12:                    document.getElementById(j).className="style7";                    document.getElementById(j).οndblclick=function shier(){BOX_show('room',obj)};                    break;                case 13:                    document.getElementById(j).className="style7";                    document.getElementById(j).οndblclick=function shisan(){BOX_show('buildline',obj)};                    break;                case 14:                    document.getElementById(j).className="style7";                    document.getElementById(j).οndblclick=function shisi(){BOX_show('rebuildline',obj)};                    break;                case 15:                    document.getElementById(j).className="style7";                    document.getElementById(j).οndblclick=function shiwu(){BOX_show('zhuanchan',obj)};                    break;                case 16:                    document.getElementById(j).className="style7";                    document.getElementById(j).οndblclick=function shiliu(){BOX_show('bianmai',obj)};                    break;                case 17:                    document.getElementById(j).className="style7";                    document.getElementById(j).οndblclick=function shiqi(){BOX_show('nextshengchan',obj)};                    break;                default:                    document.getElementById(j).className="style7";                    document.getElementById(j).οndblclick=function shiba(){BOX_show('updatesource',18)};                    break;            }        }    else        {            document.getElementById(j).className="FGray";        }    }}else if(obj==18){    for(var m=1;m<24;m++)    {    if(m > obj)        {        switch(m)            {                case 19:                case 20:                    document.getElementById(m).className="style7";                    document.getElementById(m).οndblclick=function ershi(){BOX_show('procreate',obj)};                    break;                case 22:                    document.getElementById(m).className="style7";                    document.getElementById(m).οndblclick=function ershi(){BOX_show('marketcreate',obj)};                    break;                case 23:                    document.getElementById(m).className="style7";                    document.getElementById(m).οndblclick=function ershi(){BOX_show('iso',obj)};                    break;                default:                    document.getElementById(m).className="style7";                    document.getElementById(m).οndblclick=function eryi(){BOX_show('procreate',obj)};                    break;            }        }    else        {            document.getElementById(m).className="FGray";        }    }}}  

 

 

 

 

这是调用JavaScript的语句:

<td class="style7" οndblclick="BOX_show('longterm',this.id)" id="3">                    <asp:Image ID="Image13" runat="server" ImageUrl="~/image/1.jpg" />                </td>

转载于:https://www.cnblogs.com/J2EEPLUS/archive/2010/05/06/2487930.html

最新回复(0)