隨筆 - 28, 文章 - 0, 評論 - 3, 引用 - 0
          數據加載中……

          DIV CSS網頁布局:三行三列自適應高度的DIV布局

          通常在DIV布局中,自適應高度一直是比較頭疼的問題,一般大都采用背景圖、外套DIV、右欄覆蓋左欄來解決。現在加了腳本后,簡單多了,假如有三個水平并列的DIV,fbox、mbox、sbox,只要在標簽中寫入:onload="P7_equalCols('fbox','mbox','sbox')",測試條件:ie5.x、ie6.0、FF1.03、NS7.2、opera8.01   
          JS代碼:版權歸原作者,僅供學習研究.
           Example Source Codeom]
          /*  
          ------------------------------------------------ 
          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 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=0;i dA[i].style.height=h+'px';}else{P7_eqA(dA[i].id,dA[i].offsetHeight,h);}}if(an){ 
          for(i=0;ih){ 
          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 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

          posted on 2010-02-25 10:08 Angle Wang 閱讀(537) 評論(0)  編輯  收藏 所屬分類: CSS

          主站蜘蛛池模板: 特克斯县| 兴业县| 左权县| 茌平县| 三明市| 高邑县| 鹤山市| 渭南市| 垦利县| 石河子市| 湘潭市| 清水县| 赣榆县| 利津县| 郁南县| 潞西市| 屏边| 湟中县| 长海县| 天长市| 海安县| 抚宁县| 金平| 鹿邑县| 平潭县| 大连市| 德江县| 宁津县| 海林市| 镇原县| 双流县| 安远县| 伊通| 商丘市| 天峻县| 桐乡市| 五峰| 奉化市| 泸溪县| 阜康市| 江都市|