手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网络编程>Xml编程>列表

XML创建可排序、分页的数据显示页面

来源:互联网 作者:west263.com 时间:2008-02-23
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!


redisplay (CurrentPage.innerHTML)

End Function

'' 重新设置每页的记录数
Function setRecordsPerPage()

If IsNumeric(RecordsPerPage.Value) Then
intRecordsPerPage = CInt(RecordsPerPage.Value)
window_onload
End If

End Function

'' 显示页数信息
Function setPageCount()

Dim intTotalRecords

PageCount.innerHTML = getNumberOfPages(intTotalRecords)
RecordCount.innerHTML = intTotalRecords
CurrentPage.innerHTML = 1

End Function

'' 计算总页数和总记录数
Function getNumberOfPages(intTotalRecords)

Dim intPages

intTotalRecords = Data.XMLDocument.selectNodes("/*/*").length
intPages = intTotalRecords / intRecordsPerPage
If InStr(intPages, ".") > 0 Then
intPages = CInt(Left(intPages, InStr(intPages, "."))) 1
End If

getNumberOfPages = intPages

End Function

'' “下一页”的处理
Function nextPage(intPage)

Dim strDisplay
Dim strDateRange

If CInt(CStr(intPage) * intRecordsPerPage) < Data.selectNodes("/*/*").length Then
intPage = CInt(intPage) 1
Style.XMLDocument.selectNodes("//@OnClick")(1).Value = "previousPage(" & intPage & ")"
Style.XMLDocument.selectNodes("//@OnClick")(2).Value = "nextPage(" & intPage & ")"
Style.XMLDocument.selectNodes("//xsl:for-each/@select")(1).Value = "./*[position() <= " & (CStr(intPage) * intRecordsPerPage) & " and position() > " & (CInt(intPage) - 1) * intRecordsPerPage & "]"
redisplay (intPage)
End If

End Function

'' 处理“上一页”
Function previousPage(intPage)

Dim strDisplay
Dim strDateRange

If intPage > 1 Then
intPage = CInt(intPage) - 1
Style.XMLDocument.selectNodes("//@OnClick")(1).Value = "previousPage(" & intPage & ")"
Style.XMLDocument.selectNodes("//@OnClick")(2).Value = "nextPage(" & intPage & ")"
Style.XMLDocument.selectNodes("//xsl:for-each/@select")(1).Value = "./*[position() <= " & (CStr(intPage) * intRecordsPerPage) & " and position() > " & (CInt(intPage) - 1) * intRecordsPerPage & "]"
redisplay (intPage)
End If

End Function

'' “第一页”的处理
Function FirstPage()

Style.XMLDocument.selectNodes("//@OnClick")(1).Value = "previousPage(1)"
Style.XMLDocument.selectNodes("//@OnClick")(2).Value = "nextPage(1)"
Style.XMLDocument.selectNodes("//xsl:for-each/@select")(1).Value = "./*[position() < " & intRecordsPerPage 1 & " and position() > 0]"
transform()
setPageCount()

End Function

'' “最末页”的处理
Function LastPage()

Dim intTotalPages
Dim intTotalRecords

intTotalPages = getNumberOfPages(intTotalRecords)
nextPage (intTotalPages - 1)

End Function
</Script>
</Head>
<body>
<p align="center" style="font-weight:bold;font-size:12pt;color:#0000FF;border-bottom:3px double red;padding-bottom:5px">客户关系表</p>
<XML id=''Data''>
<客户关系表 xmlns:dt="urn:schemas-microsoft-com:datatypes">
<客户><序号 dt:dt="int">01</序号><姓名>Mi</姓名><电子邮件>water@21cn.com</电子邮件></客户>
<客户><序号 dt:dt="int">02</序号><姓名>uyi</姓名><电子邮件>Lily@sina.com</电子邮件></客户>
<客户><序号 dt:dt="int">03</序号><姓名>uiyu</姓名><电子邮件>John@21cn.com</电子邮件></客户>
<客户><序号 dt:dt="int">04</序号><姓名>Doug</姓名><电子邮件>Karry@163.net</电子邮件></客户>
<客户><序号 dt:dt="int">05</序号><姓名>Ellen</姓名><电子邮件>vivki@sina.com</电子邮件></客户>
<客户><序号 dt:dt="int">06</序号><姓名>Frank</姓名><电子邮件>net_lover@mengxianhui.com.cn</电子邮件></客户>
<客户><序号 dt:dt="int">07</序号><姓名>Greg</姓名><电子邮件>meng@mengxianhui.com</电子邮件></客户>
<客户><序号 dt:dt="int">08</序号><姓名>Harry</姓名><电子邮件>sunny@xianhui.net</电子邮件></客户>
<客户><序号 dt:dt="int">09</序号><姓名>Ingrid</姓名><电子邮件>cathy@hotmail.com</电子邮件></客户>
<客户><序号 dt:dt="int">10</序号><姓名>Jeff</姓名><电子邮件>your@mxh.com</电子邮件></客户>
<客户><序号 dt:dt="int">11</序号><姓名>Kelly</姓名><电子邮件>Iloveyou@mengxianhui.com</电子邮件></客户>

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!