通过JavaScript实现经典Asp分页

时间:2018-06-18 13:21:52

标签: javascript pagination asp-classic paging

点击"Next"当前页面的总页数。 以下JavaScript

function paging(x){
var x;
var myAjax = new Ajax.Updater('dvReport','process.asp',{method:'get',parameters:{mode:'search_pabx_report',x:x}});
}

Sample output is attached

 x=request.QueryString("x")

 Const NumPerPage = 500
 If Request.QueryString("page") = "" then
    if x<1 then
     CurrentPage = 1
    else
     CurrentPage = x
    End if
    strSQL= "select * from pabx"
    rs.Open strSQL, adoCon,1,1
    if rs.recordcount>0 then
    response.write("<table border=1><tr>")
    response.Write("<th>Department</th><th>Name</th><th>Number</th></tr>")
 if Not rs.EOF Then
    rs.MoveFirst
    rs.PageSize = NumPerPage
        TotalPages = rs.PageCount
    rs.AbsolutePage = CurrentPage
End If
        Dim Count
        count=0
        If CurrentPage = 1 Then
        Response.Write "Prev | "
        Else
        response.Write("<a href='javascript:void(0)' 
        onClick='javascript:paging(" & CurrentPage - 1 & ");'>Prev</a> | ")
        End If
        'Display NEXT page link, if appropriate

        If CurrentPage = TotalPages Then
        Response.Write "Next"
        Else
        response.Write("<a href='javascript:void(0)' 
        onClick='javascript:paging(" & CurrentPage + 1 & ");'>Next</a>")
        End If
        %>
        <p><b><font size='2' >Displaying page<%=CurrentPage%>of 
        <%=TotalPages%>:</font></b></p><p>
        <%

        Do While Not rs.EOF and Count < rs.PageSize
        Response.write("<tr>")
        Response.Write("<td nowrap>" & rs("department") & "&nbsp;</td>")
        Response.Write("<td nowrap>" & rs("Emp_Name") & "&nbsp;</td>")
            Response.Write("<td nowrap>" & rs("ExtNo") & "&nbsp;</td>")
            response.write("</tr>")
        rs.MoveNext
        Count = Count + 1
        loop
        else
        response.Write("No Record Found")   
        end if 
        rs.close

0 个答案:

没有答案