ASP無(wú)組件分頁(yè)實(shí)現(xiàn)思路及代碼_ASP教程
推薦:ASP如何獲取真實(shí)IP地址在 ASP 中使用 Request.ServerVariables(REMOTE_ADDR) 來(lái)取得客戶(hù)端的 IP 地址,但如果客戶(hù)端是使用代理服務(wù)器來(lái)訪問(wèn),那取到的就是代理服務(wù)器的 IP 地址,而不是真正的客戶(hù)端 IP 地址。要想透過(guò)代理服務(wù)器取得客戶(hù)端的真實(shí)IP 地址,就要使用Request.ServerVariables(H
MVC下:后臺(tái)代碼:
復(fù)制代碼 代碼如下:m.hl5o.cn
public ActionResult sys(string page)
{
if (page == null)
{
string sql = "select top 15 * from dingdinfo ORDER BY dingdh desc";
ViewData["ds"] = dr.resultSet(sql, "dingdinfo");
}
if (page != null)
{
int pageSL = Convert.ToInt32(page);
string sql = "select top 15 * from dingdinfo where id not in (select top " + (pageSL - 1) * 15 + " id from dingdinfo order by dingdh desc )ORDER BY dingdh desc";
ViewData["ds"] = dr.resultSet(sql, "dingdinfo");
}
//計(jì)算pageCount
string sql1 = "select * from dingdinfo";
int pageCount = dr.resultCount(sql1,"dingdinfo");
int Chu = Convert.ToInt32(pageCount / 15);
int yuS = Convert.ToInt32(pageCount % 15);
if (pageCount > 15)
{
int pageJG = Chu;
if (yuS != 0)
{
pageJG = Chu + 1;
ViewData["jg"] = pageJG;
}
else
{
ViewData["jg"] = pageJG;
}
}
return View();
}
頁(yè)面顯示:
JS代碼:
復(fù)制代碼 代碼如下:m.hl5o.cn
<script type="text/javascript">
//分頁(yè)
function Page(id) {
window.location = "/bookIndex/sys/?page=" + id;
}
</script>
HTML代碼:
復(fù)制代碼 代碼如下:m.hl5o.cn
<td>
<% int count =Convert.ToInt32(ViewData["jg"]);
if (count != 0)
{
for (int i = 1; i <=count; i++)
{ %>
<a href = "#" onclick="Page(<%:i%>)"><%:i%></a>
<% }
}%>
</td>
頁(yè)面最終效果:

分享:asp之FSO大全對(duì)于一個(gè)支持asp和fso的空間來(lái)說(shuō)有了fso一切變得簡(jiǎn)單多了 我也是個(gè)新手寫(xiě)了一些代碼供大家學(xué)習(xí)研究用 首先看支持fso組件嗎 % 'FSO組件名稱(chēng) dim FSObject FSObject=Scripting.FileSystemObject '========================================================= '◆是否支持
相關(guān)ASP教程:
- asp FSO 讀寫(xiě)文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶(hù)真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫(kù)實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過(guò)濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁(yè)模板:ASP內(nèi)建對(duì)象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個(gè)小技巧
- eWebEditor v3.8 列目錄
- ASP如何獲取真實(shí)IP地址
- 相關(guān)鏈接:
- 教程說(shuō)明:
ASP教程-ASP無(wú)組件分頁(yè)實(shí)現(xiàn)思路及代碼
。