VB和JS是asp的左手和右手。
雙手缺一不可
這是我看了用JS調用VB實分頁後的突發奇想
應為它並不象分頁那樣每換一次頁都需要讀取一次資料
資料在頁面載入是已經讀取完畢
所以我稱它為偽分頁
先上代碼:
<div class="te_jia_ji_piao"><br /> <div class="title_1"><br /> <span class="more"><a href="#" mce_href="#">更多>></a></span><span>特價機票</span><br /> </div><br /> <%<br />Dim rs_1,totalCount,totalPage,MaxPerPage,currentPage<br />Call Opendb<br />currentPage=1<br />sql="select * from ji_piao where istj=True ORDER BY id DESC"<br />set rs_1=server.CreateObject("ADODB.recordset")<br />rs_1.open sql,conn,1,1<br />if rs_1.eof and rs_1.bof then<br />Response.Write "沒有資料"<br />Else<br />rs_1.pagesize=11<br />rs_1.absolutepage=currentPage<br />totalCount=rs_1.recordcount '記錄總數<br />totalPage=rs_1.pagecount<br />MaxPerPage=rs_1.pagesize<br />End if<br />For j=1 tors_1.pagecount'迴圈TAB框。總數為分頁後的總頁數<br /> %><br /> <div class="air" style="display:none" mce_style="display:none"><br /> <%<br />For i=1 to rs_1.pagesize<br />if rs_1.eof then<br />exit for<br />end if<br />%><br /> <div class="ji_piao"><br /> <span style="color:#000; width:90px;font-weight:normal;"><%=rs_1("data")%></span><br /> <span style="width:120px;"><%=rs_1("leave")%>—<%=rs_1("arrival")%></span><br /> <span>¥<%=rs_1("price")%></span><br /> <span><%=rs_1("discount")%></span><br /> <a href="tickets.asp?id=<%=rs_1(" mce_href="tickets.asp?id=<%=rs_1("id")%>" >訂票</a><br /> </div><br /> <%<br />rs_1.movenext<br />Next<br />%><br /> </div><br /> <%<br />Next<br />rs_1.close<br />set rs_1=nothing<br />Close conn<br />%></p><p><div style="font-size:12px; float:right; margin-right:20px;" mce_style="font-size:12px; float:right; margin-right:20px;"><br /><%<br />For i=1 to totalPage'分頁頁尾產生"[1],[2],[3]....."<br />%><br /> <a class="airfoot" href="javascript:void(0)" mce_href="javascript:void(0)" onclick="air(<%=i%>);" style="display:inline-block">[<%=i%>]</a><br /> <%<br />Next<br />%><br /> </div><br /></div><br /><mce:script type="text/javascript"><!--<br />$('.air:first').css('display','block');<br />$('.airfoot:first').css('color','#F00');<br />// --></mce:script><br />//基於JQuary架構TAB框選擇<br />function air(aa){<br />$(".air").each(function(i){<br />if (i==(aa-1))<br />$(this).css('display','block')<br />else<br />$(this).css('display','none')<br />});<br />$(".airfoot").each(function(i){<br />if (i==(aa-1))<br />$(this).css('color','#F00')<br />else<br />$(this).css('color','#000')<br />});<br />}
之所以叫偽分頁
其實所有資料在頁面被載入的時候就已經全部讀取完畢
把每一個分頁的頁面產生一個TAB框
在TAB框裡顯示各個分頁的資訊
說白了就是一個動態產生TAB框的過程
至於TBA框的選擇則是用JQuary實現
以上方法不是用於大量資訊的顯示
:
1:
2:
第一個寫部落格。不大好請見諒
有什麼問題請加我QQ815762641~