int pre = abs - 5; if (pre <= 0) { pre = 1; } for (int i = pre; i < abs; i++) { jiyong += string.Format(urlFormat, "page", string.Format(url, i.ToString()), i.ToString(), ""); } //当前页 jiyong += string.Format(urlFormat2, "abs", string.Format(url, abs.ToString()), "<a>" + abs.ToString() + "</a>", "disabled=\"true\"");
//loop下5页 int next = abs + 5; if (next > pageNum) next = pageNum; for (int i = abs+1; i < next+1; i++) { jiyong += string.Format(urlFormat, "page", string.Format(url, i.ToString()), i.ToString(), ""); } //下一页
if (abs == pageNum) { //jiyong += "<li class=\"p10\"><a href=\"" + string.Format(url, abs) + "\">; jiyong += string.Format(urlFormat2, "pre", string.Format(url, (abs + 1).ToString()), "<a>></a>", "disabled=\"true\""); } else { jiyong += string.Format(urlFormat, "pre", string.Format(url, (abs + 1).ToString()), ">", ""); } //.尾页
if (abs == pageNum) { //jiyong += "<li class=\"p10\"><a href=\"" + string.Format(url, abs) + "\">; jiyong += string.Format(urlFormat2, "last", string.Format(url, pageNum.ToString()), "<a>>></a>", "disabled=\"true\""); } else { jiyong += string.Format(urlFormat, "last", string.Format(url, pageNum.ToString()), ">>", ""); } return jiyong; } }
|