最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

腳本控制三行三列自適應(yīng)高度DIV布局

 更新時(shí)間:2007年01月29日 00:00:00   作者:  
這個(gè)例子是用JS腳本控制并列DIV的高度,通常在DIV布局中,自適應(yīng)高度一直是比較頭疼的問題,一般大都采用背景圖、外套DIV、右欄覆蓋左欄......來解決?,F(xiàn)在加了腳本后,簡單多了,假如有三個(gè)水平并列的DIV,fbox、mbox、 sbox,只要在<body>標(biāo)簽中寫入:onload="P7_equalCols('fbox','mbox','sbox')",測試條件:ie5.x、ie6.0、FF1.03、NS7.2、opera8.01。最終效果。

JS代碼:版權(quán)歸原作者 ,僅供學(xué)習(xí)研究. 
復(fù)制代碼 代碼如下:

/* 
------------------------------------------------ 
PVII Equal CSS Columns scripts 
Copyright (c) 2005 Project Seven Development 
www.projectseven.com 
Version: 1.5.0 
------------------------------------------------ 
*/ 
function P7_colH(){ //v1.5 by PVII-www.projectseven.com 
var i,oh,hh,h=0,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){ 
for(i=0;i<dA.length;i++){dA[i].style.height='auto';}for(i=0;i<dA.length;i++){ 
oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=0;i<dA.length;i++){if(an){ 
dA[i].style.height=h+'px';}else{P7_eqA(dA[i].id,dA[i].offsetHeight,h);}}if(an){ 
for(i=0;i<dA.length;i++){hh=dA[i].offsetHeight;if(hh>h){ 
dA[i].style.height=(h-(hh-h))+'px';}}}else{document.p7eqa=1;} 
document.p7eqth=document.body.offsetHeight; 
document.p7eqtw=document.body.offsetWidth;} 

function P7_eqT(){ //v1.5 by PVII-www.projectseven.com 
if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw! =document.body.offsetWidth){ 
P7_colH();} 

function P7_equalCols(){ //v1.5 by PVII-www.projectseven.com 
if(document.getElementById){document.p7eqc=new Array;for(i=0;i<arguments.length;i++){ 
document.p7eqc[i]=document.getElementById(arguments[i]);} setInterval("P7_eqT()",10);} 

function P7_eqA(el,h,ht){ //v1.5 by PVII-www.projectseven.com 
var sp=10,inc=10,nh=h,g=document.getElementById(el),oh=g.offsetHeight,ch=parseInt(g.style.height) ; 
ch=(ch)?ch:h;var ad=oh-ch,adT=ht-ad;nh+=inc;nh=(nh>adT)?adT:nh;g.style.height=nh+'px'; 
oh=g.offsetHeight;if(oh>ht){nh=(ht-(oh-ht));g.style.height=nh+'px';} 
if(nh<adT){setTimeout("P7_eqA('"+el+"',"+nh+","+ht+") ",sp);} 



[Ctrl+A 全選 注:引入外部Js需再刷新一下頁面才能執(zhí)行]

相關(guān)文章

最新評(píng)論

巴塘县| 岳阳县| 纳雍县| 伽师县| 申扎县| 南汇区| 宣城市| 宣城市| 和平县| 双流县| 太康县| 三台县| 和平县| 宣化县| 保山市| 兴仁县| 北宁市| 长岭县| 江口县| 铅山县| 吉木萨尔县| 黑水县| 东阿县| 长白| 偃师市| 普格县| 新郑市| 屏东市| 广水市| 焦作市| 新宾| 永春县| 黄山市| 同仁县| 边坝县| 云阳县| 安康市| 孟村| 德江县| 旺苍县| 台中县|