<div class="codetitle"> <span><a style="CURSOR: pointer" data="86191" class="copybut" id="copybut86191" onclick="doCopy('code86191')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code86191"> <br> <br> <br><title>拉动滚动条加载数据</title> <br><script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <br><script type="text/javascript"> <BR>$(function () { <BR>var i = 4;$(window).bind("scroll", function (event) <BR>{ <BR>//滚动条到网页头部的 高度,兼容ie,ff,chrome <BR>var top = document.documentElement.scrollTop + document.body.scrollTop; <BR>//网页的高度 <BR>var textheight = $(document).height(); <BR>// 网页高度-top-当前窗口高度 <BR>if (textheight - top - $(window).height() <= 100) { if (i >= 100) { return; <BR>//控制最大只能加载到100 <BR>} <BR>$('#div1').css("height", $(document).height() + 100);i++; <BR>//可以根据实际情况,获取动态数据加载 到 div1中 <BR>$('<div>' + i + '</script> </div>').appendTo($('#div1')); <br>} <br>}); <br>}) <br> <br><style> <BR>#div1 div <BR>{ <BR>font-size: 100px; <BR>background: #ccc; <BR>margin-top: 5px; <BR>} <BR></style> <br> <br> <br><form id="form1" runat="server"> <br><div style="height: 1000px;" id="div1"> <br><div> <br> </div> <br><div> <br> </div> <br><div> <br> </div> <br><div> <br> </div> <br> </div> <br> </form> <br> <br> <br>