function showDiv(name)
{
var cf=document.getElementById("DivID");
var oImg=document.getElementById(name);
var eT=0,eL=0,p=oImg;
var sT=document.body.scrollTop,sL=document.body.scrollLeft;
var eH=oImg.height+25,eW=oImg.width;
while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}
cf.style.top=((document.body.clientHeight-(eT-sT)-eH>=cf.style.posHeight)?eT+eH:eT-cf.style.posHeight)-4;
cf.style.left=((document.body.clientWidth-(eL-sL)>=cf.style.posWidth)?eL:eL+eW-cf.style.posWidth);
}
Div绝对定位js代码
最新推荐文章于 2022-07-31 19:49:31 发布