zoukankan      html  css  js  c++  java
  • 分页控件(.ascx文件)

    <script>        
            
    var strURL='<%=strURL%>';
            
    var recordNum=<%=recordNum%>;
            
    var perPageNum=<%=perPageNum%>;
            
    var currentPage=<%=pageIndex%>;
            
    var p=<%=pageIndex%>-1;
            
    var fontcolor='<%=fontcolor%>';
            
            
    if(recordNum%perPageNum==0
            {
                pageNum
    =recordNum/perPageNum;
            }
            
    else
            {
                pageNum
    =(recordNum-recordNum%perPageNum)/perPageNum+1;
            }
            document.write('
    <table border="0" cellpadding="0" cellspacing="3" width="<%=tableWidth%>" align="center" >');
            document.write('
    <form method=post action="'+strURL+'">');        
            document.write('
    <tr style="font-size: 12px;"><td valign="middle">');
            document.write('页次:
    <b>'+currentPage+</b>/<b> '+pageNum+ '</b>页 每页<b>'+perPageNum+</b> 共计:<b>   '+recordNum+</b>条数据</td>');
            document.write('
    <td valign="middle"><div align="right" >分页:');
            
    if(currentPage==1)
            {
                document.write('
    <font face=webdings color="'+fontcolor+'">9</font>');
            }
            
    else
            {
                document.write('
    <a href="'+strURL+'?page=1" title="首页"><font face=webdings>9</font></a>');
            }
            
    if(currentPage>10)
            {
                document.write(' 
    <a href="'+strURL+'?page='+(currentPage-10)+'" title="上十页"><font face=webdings>7</font></a> ');
            }
            document.write('
    <b>');
            
    for (i=p-p%10+1;i<p-p%10+1+10;i++)
            {
                
    if(i==pageNum+1
                    
    break;
                
    if(i==currentPage)
                {
                    document.write(' 
    <font color="'+fontcolor+'">'+i+'</font> ');
                }
                
    else
                {
                    document.write(' 
    <a href="'+strURL+'?page='+i+'">'+i+'</a> ');
                }
            }
            document.write('
    </b>');
            
    if(pageNum-currentPage>=10)
            {
                document.write('
    <a href="'+strURL+'?page='+(currentPage+10)+'" title="下十页"><font face=webdings>8</font></a> ');
            }
            
    if(currentPage!=pageNum)
            {
                document.write('
    <a href="'+strURL+'?page='+pageNum+'" title="尾页"><font face=webdings>:</font></a>  ');
            }
            
    else
            {
                document.write('
    <Font face=webdings color="'+fontcolor+'">:</font>');
            }
             
            document.write(' 转到:
    <input type=text size=3 maxlength=10 value="'+currentPage+'" name=Page><input type=submit value=Go name=submit>');//按钮好像不行,需要完善
            document.write('</div></td></tr>');
            document.write('
    </form></table>');
        
    </script>

            public string strURL="WebForm1.aspx";        
            
    public int recordNum=1000;
            
    public int perPageNum=20;
            
    public int pageIndex;
            
    public string tableWidth="100%";
            
    public string fontcolor="red";

            
    private void Page_Load(object sender, System.EventArgs e)
            
    {
                
    // 在此处放置用户代码以初始化页面
                pageIndex = System.Convert.ToInt32(Request.QueryString["page"]);
            }

  • 相关阅读:
    使用ueditor实现多图片上传案例——DaoImpl层(BaseDaoUtilImpl)
    使用ueditor实现多图片上传案例——Dao层(IShoppingDao)
    使用ueditor实现多图片上传案例——Dao层(IBaseDaoUtil)
    使用ueditor实现多图片上传案例——Dao层(BaseDao)
    使用ueditor实现多图片上传案例——实体类(Shopping.java)
    使用ueditor实现多图片上传案例
    java实现人脸识别源码【含测试效果图】——前台页面层(login.jsp)
    oracle 使用leading, use_nl, rownum调优(引用)
    oracle 使用leading, use_nl, rownum调优(引用)
    [转载]spring+proxool
  • 原文地址:https://www.cnblogs.com/xiaodi/p/123140.html
Copyright © 2011-2022 走看看