<div class="codetitle"> <span><a style="CURSOR: pointer" data="53475" class="copybut" id="copybut53475" onclick="doCopy('code53475')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code53475"> <br><br><title>脚本控制三行三列自适应高度DIV布局</title> <br><meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <br><script type="text/javascript"> <BR>/* <BR>------------------------------------------------ <BR>PVII Equal CSS Columns scripts <BR>Copyright (c) 2005 Project Seven Development <BR>www.projectseven.com <BR>Version: 1.5.0 <BR>------------------------------------------------ <BR>*/ <BR>function P7_colH(){ //v1.5 by PVII-www.projectseven.com <BR>var i,oh,hh,h=0,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){ <BR>for(i=0;i<dA.length;i++){dA[i].style.height='auto';}for(i=0;i<dA.length;i++){ <BR>oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=0;i<dA.length;i++){if(an){ <BR>dA[i].style.height=h+'px';}else{P7_eqA(dA[i].id,dA[i].offsetHeight,h);}}if(an){ <BR>for(i=0;i<dA.length;i++){hh=dA[i].offsetHeight;if(hh>h){ <BR>dA[i].style.height=(h-(hh-h))+'px';}}}else{document.p7eqa=1;} <BR>document.p7eqth=document.body.offsetHeight; <BR>document.p7eqtw=document.body.offsetWidth;} <BR>} <BR>function P7_eqT(){ //v1.5 by PVII-www.projectseven.com <BR>if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){ <BR>P7_colH();} <BR>} <BR>function P7_equalCols(){ //v1.5 by PVII-www.projectseven.com <BR>if(document.getElementById){document.p7eqc=new Array;for(i=0;i<arguments.length;i++){ <BR>document.p7eqc[i]=document.getElementById(arguments[i]);}setInterval("P7_eqT()",10);} <BR>} <BR>function P7_eqA(el,h,ht){ //v1.5 by PVII-www.projectseven.com <BR>var sp=10,inc=10,nh=h,g=document.getElementById(el),oh=g.offsetHeight,ch=parseInt(g.style.height); <BR>ch=(ch)?ch:h;var ad=oh-ch,adT=ht-ad;nh+=inc;nh=(nh>adT)?adT:nh;g.style.height=nh+'px'; <BR>oh=g.offsetHeight;if(oh>ht){nh=(ht-(oh-ht));g.style.height=nh+'px';} <BR>if(nh<adT){setTimeout("P7_eqA('"+el+"',"+nh+","+ht+")",sp);} <BR>} <BR></script><br><br><style type="text/css">BODY { <BR>PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 75%; PADDING-BOTTOM: 0px; MARGIN: 5px; LINE-HEIGHT: 100%; PADDING-TOP: 0px; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif <BR>} <BR>#header { <BR>PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px auto; WIDTH: 760px; PADDING-TOP: 0px <BR>} <BR>#mid { <BR>PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px auto; WIDTH: 760px; PADDING-TOP: 0px <BR>} <BR>#footer { <BR>PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px auto; WIDTH: 760px; PADDING-TOP: 0px <BR>} <BR>#header { <BR>BACKGROUND: #f4f4f4; MARGIN-BOTTOM: 5px; HEIGHT: 60px <BR>} <BR>H3 { <BR>MARGIN: 0px; COLOR: #708090; PADDING-TOP: 25px; TEXT-ALIGN: center <BR>} <BR>H5 { <BR>MARGIN: 0px; COLOR: #708090; PADDING-TOP: 25px; TEXT-ALIGN: center <BR>} <BR>#fbox { <BR>BACKGROUND: #f1f1f1; FLOAT: left; WIDTH: 195px <BR>} <BR>#mbox { <BR>PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BACKGROUND: #dff7ff; FLOAT: left; PADDING-BOTTOM: 0px; MARGIN: 0px 5px; WIDTH: 360px; PADDING-TOP: 0px <BR>} <BR>#sbox { <BR>BACKGROUND: #ffebcc; FLOAT: right; WIDTH: 195px <BR>} <BR>P { <BR>PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; MARGIN: 0px; TEXT-INDENT: 2em; LINE-HEIGHT: 130%; PADDING-TOP: 10px <BR>} <BR>#footer { <BR>CLEAR: both; BORDER-TOP: #ffffff 5px solid; BACKGROUND: #cddbed; HEIGHT: 60px; TEXT-ALIGN: center <BR>} <BR></style> <br><br><meta content="MSHTML 6.00.2900.2873" name="GENERATOR"> <br><br><div id="header"> <br><h3></h3> </div> </div>