<table class="zixun-con-table"> <tr class="hover"> <th style="100px;"></th> <th style="120px;"></th> <th style="120px;"></th> <th style="120px;"></th> <th style="120px;"></th> <th style="100px;"></th> </tr> </table> <div id="demo0" style="680px;overflow:hidden;height:200px;"> <div id="demo11" onmouseover="iii=1" style="680px;overflow:hidden;" onmouseout="iii=0" > <table class="zonghexinxi-table"> <s:iterator value="zx15" status="s"> <s:if test="#s.index>=0&&stopFlag!=2"> <tr> <td style="100px;"></td> <td style="120px;" class="center stars zx15StarLevel" stars="${startlevel }"></td> <td style="120px;"></td> <td style="120px;"></td> <td style="120px;"> </td> <td style="100px;"></td> </tr> </s:if> </s:iterator> </table> </div> <div id="demo22" style="680px;overflow:hidden;"></div> <script type="text/javascript"> var iii=0;t=demo11.clientHeight; demo22.innerHTML=demo11.innerHTML; zoumadeng('demo0','demo11','demo22','iii','60'); </script> </div> </div> </div>
//demo0:外围的div的id;demo11:第一层div的id; demo22;被复制div的id; length:demo11和demo22的id; flag指鼠标是否在div内 function zoumadeng(demo0,demo11,demo22,flag,speed){ var m = $("#"+demo11).height()*2; if($("#"+demo0).height()<m){ if($("#"+demo0).height()>$("#"+demo11).height()){ $("#"+demo11).height($("#"+demo0).height()+$("#"+demo11).height()); $("#"+demo22).height($("#"+demo0).height()+$("#"+demo11).height()); }else{ $("#"+demo11).height($("#"+demo11).height()); $("#"+demo22).height($("#"+demo11).height()); } }else{ $("#"+demo11).height($("#"+demo0).height()+$("#"+demo11).height()); $("#"+demo22).height($("#"+demo0).height()+$("#"+demo11).height()); } var t = setInterval("qswhMarquee("+demo0+","+demo11+","+flag+")", speed); //$("#"+demo0).mouseover(function(){clearInterval(t);}, function(){t = setInterval("qswhMarquee("+demo0+","+demo11+","+flag+")", speed);}); $("#"+demo0).mouseover(function(){clearInterval(t);}); $("#"+demo0).mouseleave(function(){t = setInterval("qswhMarquee("+demo0+","+demo11+","+flag+")", speed);}); } function qswhMarquee(demo0,demo11,flag){ if(flag==1){ return; }else{ if(demo0.scrollTop==demo11.clientHeight){ demo0.scrollTop-=demo11.offsetHeight; }else{ demo0.scrollTop++; } } }