js實現ASP分頁函數 HTML分頁函數

來源:互聯網
上載者:User

複製代碼 代碼如下:<!--
//ASP分頁函數
function ShowListPage(page,Pcount,TopicNum,maxperpage,strLink,ListName){
var alertcolor = '#FF0000';
maxperpage=Math.floor(maxperpage);
TopicNum=Math.floor(TopicNum);
page=Math.floor(page);
var n,p;
if ((page-1)%10==0) {
p=(page-1) /10
}else{
p=(((page-1)-(page-1)%10)/10)
}
if(TopicNum%maxperpage==0) {
n=TopicNum/maxperpage;
}else{
n=(TopicNum-TopicNum%maxperpage)/maxperpage+1;
}
document.write ('<table border="0" cellpadding="0" cellspacing="1" class="Tableborder5">');
document.write ('<form method=post action="?pcount='+Pcount+strLink+'">');
document.write ('<tr align="center">');
document.write ('<td class="tabletitle1" title="'+ListName+'"> '+ListName+' </td>');
document.write ('<td class="tabletitle1" title="總數"> '+TopicNum+' </td>');
document.write ('<td class="tabletitle1" title="每頁"> '+maxperpage+' </td>');
document.write ('<td class="tabletitle1" title="頁次"> '+page+'/'+Pcount+'頁 </td>');
if (page==1){
document.write ('<td class="tablebody1"> <font face=webdings>9</font> </td>');
}else{
document.write ('<td class="tablebody1"> <a href="?page=1'+strLink+'" title="首頁"><font face=webdings>9</font></a> </td>');
}
if (p*10 > 0){
document.write ('<td class="tablebody1"> <a href="?page='+p*10+strLink+'" title="上十頁"><font face=webdings>7</font></a> </td>');
}
if (page < 2){
document.write ('<td class="tablebody1"> 首 頁 </td>');
document.write ('<td class="tablebody1"> 上一頁 </td>');
}else{
document.write ('<td class="tablebody1"> <a href="?page=1'+strLink+'" title="首頁">首 頁</a> </td>');
document.write ('<td class="tablebody1"> <a href="?page='+(page-1)+strLink+'" title="上一頁">上一頁</a> </td>');
}
if (Pcount-page < 1){
document.write ('<td class="tablebody1"> 下一頁 </td>');
document.write ('<td class="tablebody1"> 尾 頁 </td>');
}else{
document.write ('<td class="tablebody1"> <a href="?page='+(page+1)+strLink+'" title="下一頁">下一頁</a> </td>');
document.write ('<td class="tablebody1"> <a href="?page='+Pcount+strLink+'" title="尾頁">尾 頁</a> </td>');
}
for (var i=p*10+1;i<p*10+11;i++){
if (i==n) break;
}
if (i<n){
document.write ('<td class="tablebody1"> <a href="?page='+i+strLink+'" title="下十頁"><font face=webdings>8</font></a> <td>');
}
if (page==n){
document.write ('<td class="tablebody1"> <Font face=webdings>:</font> </td>');
}else{
document.write ('<td class="tablebody1"> <a href="?page='+n+strLink+'" title="尾頁"><font face=webdings>:</font></a> </td>');
}
document.write ('<td class="tablebody1"><input class="PageInput" type=text name="page" size=1 maxlength=10 value="'+page+'"></td>');
document.write ('<td class="tablebody1"><input type=submit value=Go name=submit class="PageInput"></td>');
document.write ('</tr>');
document.write ('</form></table>');
}
//HTML分頁函數
function ShowHtmlPage(page,Pcount,TopicNum,maxperpage,strLink,ExtName,ListName){
var alertcolor = '#FF0000';
maxperpage=Math.floor(maxperpage);
TopicNum=Math.floor(TopicNum);
page=Math.floor(page);
var n,p;
if ((page-1)%10==0) {
p=(page-1) /10
}else{
p=(((page-1)-(page-1)%10)/10)
}
if(TopicNum%maxperpage==0) {
n=TopicNum/maxperpage;
}else{
n=(TopicNum-TopicNum%maxperpage)/maxperpage+1;
}
document.write ('<table border="0" cellpadding="0" cellspacing="1" class="Tableborder5">');
document.write ('<form method=post>');
document.write ('<tr align="center">');
document.write ('<td class="tabletitle1" title="'+ListName+'"> '+ListName+' </td>');
document.write ('<td class="tabletitle1" title="總數"> '+TopicNum+' </td>');
document.write ('<td class="tabletitle1" title="每頁"> '+maxperpage+' </td>');
document.write ('<td class="tabletitle1" title="頁次"> '+page+'/'+Pcount+'頁 </td>');
if (page==1){
document.write ('<td class="tablebody1"> <font face=webdings>9</font> </td>');
}else{
document.write ('<td class="tablebody1"> <a href="index'+ExtName+'" title="首頁"><font face=webdings>9</font></a> </td>');
}
if (p*10 > 0){
document.write ('<td class="tablebody1"> <a href="'+strLink+(p*10)+ExtName+'" title="上十頁"><font face=webdings>7</font></a> </td>');
}
if (page < 3){
document.write ('<td class="tablebody1"> 首 頁 </td>');
document.write ('<td class="tablebody1"> <a href="index'+ExtName+'" title="上一頁">上一頁1</a> </td>');
}else{
document.write ('<td class="tablebody1"> <a href="index'+ExtName+'" title="首頁">首 頁1/a> </td>');
document.write ('<td class="tablebody1"> <a href="'+strLink+(page-1)+ExtName+'" title="上一頁">上一頁</a> </td>');
}
if (Pcount-page < 1){
document.write ('<td class="tablebody1"> 下一頁1 </td>');
document.write ('<td class="tablebody1"> 尾 頁 </td>');
}else{
document.write ('<td class="tablebody1"> <a href="'+strLink+(page+1)+ExtName+'" title="下一頁">下一頁</a> </td>');
document.write ('<td class="tablebody1"> <a href="'+strLink+Pcount+ExtName+'" title="尾頁">尾 頁</a> </td>');
}
for (var i=p*10+1;i<p*10+11;i++){
if (i==n) break;
}
if (i<n){
document.write ('<td class="tablebody1"> <a href="'+strLink+i+ExtName+'" title="下十頁"><font face=webdings>8</font></a> <td>');
}
if (page==n){
document.write ('<td class="tablebody1"> <Font face=webdings>:</font> </td>');
}else{
document.write ('<td class="tablebody1"> <a href="'+strLink+n+ExtName+'" title="尾頁"><font face=webdings>:</font></a> </td>');
}
//document.write ('<td class="tabletitle1" title="轉到"> GO </td>');
document.write ('<td class="tablebody1"><select class="PageInput" name="page" size="1" onchange="javascript:window.location=this.options[this.selectedIndex].value;">');
document.write ('<option value="index'+ExtName+'">第1頁</option>');
for (var i=2;i<TopicNum;i++){
if (i==page){
document.write ('<option value="'+strLink+i+ExtName+'" selected>第'+i+'頁</option>');
}else{
if (i==1){
document.write ('<option value="index'+ExtName+'">第1頁</option>');
}else{
document.write ('<option value="'+strLink+i+ExtName+'">第'+i+'頁</option>');
}
}
if (i==n) break;
}
document.write ('</select></td>');
document.write ('</tr>');
document.write ('</form></table>');
}
//-->
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.