<script>ec(2);</script> <span class="bold">自己的写的分页函数,大家看看</span> //制造sql部分 Function makesql(keyword,page,sidk,bigleibiek) //keyword搜索,page页数,sidk小类,bigleibiek大类 dim keywordlist,i,sql if keyword<>"" then keywordlist=split(keyword) for i=0 to ubound(keywordlist) keywordlist(i)=trim(keywordlist(i)) sql=sql&" (namek like '%"&keywordlist(i)&"%' or dizik like '%"&keywordlist(i)&"%' or tesek like '%"&keywordlist(i)&"%') and" next end if if (page="" or page<1) then page=1 if sidk<>"" then sql=sql&" leibiek="&sidk&" and" if page=1 then sql="select top 8 idk,pick,namek,dizik,tesek,dianhuak,dianjik,pinlunk from shop where"&sql&" bigleibiek="&bigleibiek&" order by idk desc" else sql="select top 8 idk,pick,namek,dizik,tesek,dianhuak,dianjik,pinlunk from shop where idk <(select min(idk) from( select top "&8*(page-1)&" idk from shop where"&sql&" bigleibiek="&bigleibiek&" order by idk desc)) and"&sql&" bigleibiek="&bigleibiek&" order by idk desc" end if makesql=sql End Function //在中间得到记录集和记录集个数,关闭rs // //制造上下页部分 //sidk小类,keyword搜索,page当前页数,rscount符合条件的记录数 sub pages(sidk,keyword,page,rscount) dim pages_sort,jj,pages_keyword,kk,pages_page1,pages_page2 if trim(sidk)<>"" then pages_sort="sort="&sidk jj="&" end if if trim(keyword)<>"" then pages_keyword=jj&"keyword="&keyword kk="&" end if kk=left(jj&kk,1) if trim(page)="" then page=1 if trim(page)<>"" then if page<2 then pages_page1="" pages_page2=kk&"page=2" else pages_page1=kk&"page="&(page-1) pages_page2=kk&"page="&(page 1) end if end if if rscount<8 then pages_page2="&page="&page response.Write( "<div id='page'><form name='page' method='get'><a title='首页' href='index.asp?"&pages_sort&pages_keyword&"'>首页</a><a title='上一页' href='index.asp?"&pages_sort&pages_keyword&pages_page1&"'>上一页</a>"&page&"<a title='下一页' href='index.asp?"&pages_sort&pages_keyword&pages_page2&"'>下一页</a><input type='text' name='page' value='"&page&"' id='page_size' /><input type='hidden' value='"&keyword&"' name='keyword' /><input type='hidden' value='"&sidk&"' name='sort' /><input type='submit' value='跳转' /></form></div>") End sub
|