public sub getsubmitform1()
'页导航的javascript函数
response.write " "+vrcrlf
response.write ("<script language=""javascript"">") +vbcrlf
response.write " function generalsubmit(i)"+vbcrlf
response.write " {"+vbcrlf
response.write " document."&submitform&".flag.value=""query1111111155555"";"+vbcrlf
response.write " document."&submitform&".currentpage.value=i;"+vbcrlf
response.write " "&submitform&".submit();"+vbcrlf
response.write " }"+vbcrlf
'改变页大小的javascript函数
response.write " function changepagesize(ii)"+vbcrlf
response.write " {"+vbcrlf
response.write " document."&submitform&".flag.value=""query1111111155555"";"+vbcrlf
response.write " document."&submitform&".currentpage.value=1;"+vbcrlf
response.write " document."&submitform&".pagesize.value=ii;"+vbcrlf
response.write " "&submitform&".submit();"+vbcrlf
response.write " }"+vbcrlf
response.write ("</script>")+vbcrlf
response.write " "+vrcrlf
end sub
'==================================================================
'totalrecordcount 属性
'关于记录总数
'
'==================================================================
public property let totalrecordcount(int_totalrecordcount)
if isnumeric(int_totalrecordcount) then
int_totalrecord=clng(int_totalrecordcount)
end if
end property
public property get totalrecordcount
if not(int_totalrecord="" or (not(isnumeric(int_totalrecord)))) then
totalrecordcount=int_totalrecord
end if
end property
'==================================================================
'getrecordcount 方法
'返回当前记录数
'
'==================================================================
public function getrecordcount()
getrecordcount=int_totalrecord
end function
'==================================================================
'class_initialize 类的初始化
'初始化当前页的值
'
'==================================================================
private sub class_initialize
'========================
'设定一些参数的黙认值
'========================
' xd_pagesize=10 '设定分页的默认值为10
'========================
'获取当前面的值
'========================
if request("currentpage")="" then
int_curpage=1
elseif not(isnumeric(request("currentpage"))) then
int_curpage=1
elseif cint(trim(request("currentpage")))<1 then
int_curpage=1
else
int_curpage=cint(trim(request("currentpage")))
end if
end sub
'=============================================
'showpage 创建分页导航条
'有首页、前一页、下一页、末页、还有数字导航
'
'=============================================
public sub showpage()
dim str_tmp
xd_surl = geturl()
' int_totalrecord=xd_rs.recordcount
if int_totalrecord<=0 then
str_error=str_error & "总记录数为零,请输入数据"
call showerror()
end if
if int_totalrecord="" then
int_totalpage=1
else
'modify by wls 041215 for the right pages display---------------
if int_totalrecord mod pagesize =0 then
int_totalpage = clng(int_totalrecord \ xd_pagesize * -1)*-1
else
int_totalpage = clng(int_totalrecord \ xd_pagesize * -1)*-1+1
end if
end if
if int_curpage>int_totalpage then
int_curpage=int_totalpage
end if
'========================================================
'显示分页信息,各个模块根据自己要求更改显求位置
'========================================================
'response.write " "
str_tmp=showfirstprv
response.write str_tmp
str_tmp=shownumbtn
response.write str_tmp
str_tmp=shownextlast
response.write str_tmp
str_tmp=showpageinfo
response.write str_tmp
response.write " "
showgoto
end sub
'=============================================
'showfirstprv 显示首页、前一页
'
'
'=============================================
private function showfirstprv()
dim str_tmp,int_prvpage
if int_curpage=1 then
str_tmp=btn_first&" "&btn_prev
elseif int_curpage=0 then
str_tmp=btn_first&" "&btn_prev
else
int_prvpage=int_curpage-1
str_tmp="<a href=""#"" onclick=""javascript:generalsubmit('1')"" alt=""第一页"">" & btn_first&"</a> <a href=""#"" onclick=""javascript:generalsubmit('"&int_prvpage&"')"" alt=""前一页"">" & btn_prev&"</a>"
end if
showfirstprv=str_tmp
end function
'=============================================
'shownextlast 下一页、末页
'
'
'=============================================
private function shownextlast()
dim str_tmp,int_nextpage
if int_curpage>=int_totalpage then
str_tmp=btn_next & " " & btn_last
else
int_nextpage=int_curpage+1
str_tmp="<a href=""#"" onclick=""javascript:generalsubmit('"&int_nextpage&"')"" alt=""后一页"">" & btn_next&"</a> <a href=""#"" onclick=""javascript:generalsubmit('"&int_totalpage&"')"" alt=""最后一页"">" & btn_last&"</a>"
end if
shownextlast=str_tmp
end function
'end function
'=============================================
'shownumbtn 修改后的数字导航
'
'=============================================
function shownumbtn()
dim i,str_tmp,end_page,start_page
start_page=1
'add by sll 2005.05.20 int_curpage=0
if int_curpage=0 then
str_tmp=str_tmp&"0"
else
if int_curpage>1 then
start_page=int_curpage
if (int_curpage<=5) then
start_page=1
end if
if (int_curpage>5) then
start_page=int_curpage-2
end if
end if
end_page=start_page+5
if end_page>int_totalpage then
end_page=int_totalpage
end if
for i=start_page to end_page
strtemp=xd_surl & cstr(i)
str_tmp=str_tmp & "[<a href=""#"" onclick=""javascript:generalsubmit('"&i&"')"">"&i&"</a>] "
next
end if
shownumbtn=str_tmp
end function
'=============================================
'showgoto 页面跳转
'页面自动跳转
'add by sll 2005.05.20
'=============================================
private function showgoto()
'response.write int_totalpage
dim inti
if int_totalpage<=0 then
response.write "<select name='goto' disabled>"
response.write "<option value='0'>0</option>"
response.write "</select>"
else
response.write "<select name='goto' onchange='javascript:generalsubmit(this.value)'>"
for inti=1 to int_totalpage
response.write "<option value='"&inti&"'"
if cstr(inti)=cstr(int_curpage) then
response.write "selected"
end if
response.write" >"&inti&"</option>"
next
response.write "</select>"
end if
end function
'=============================================
'showpageinfo 分页信息
'根据要求自行修改
'
'=============================================
private function showpageinfo()
dim str_tmp
str_tmp=" [页次:<font color=red>"&int_curpage&"</font>/"&int_totalpage&"页] [共"&int_totalrecord&"条] ["&xd_pagesize&"条/页]"
showpageinfo=str_tmp
end function
'=============================================
'showpagesizechange 改变页大小
'根据要求自行修改
'
'=============================================
public sub showpagesizechange()
dim str_tmp
str_tmp="页大小:<select name='ssssspagesize' onchange='changepagesize(this.value)'>"
str_tmp=str_tmp & "<option"
if xd_pagesize=10 then str_tmp =str_tmp & " selected "
str_tmp=str_tmp & " value='10'>10</option>"
str_tmp=str_tmp & "<option"
if xd_pagesize=20 then str_tmp =str_tmp & " selected "
str_tmp=str_tmp & " value='20'>20</option>"
str_tmp=str_tmp & "<option"
if xd_pagesize=50 then str_tmp =str_tmp & " selected "
str_tmp=str_tmp & " value='50'>50</option>"
str_tmp=str_tmp & "<option"
if xd_pagesize=int_totalrecord then str_tmp =str_tmp & " selected "
str_tmp=str_tmp & " value='" & int_totalrecord & "'>all</option>"
str_tmp=str_tmp & "</select>"
response.write str_tmp
end sub
'=============================================
'修改后的获取当前url参数的函数
'codeing by redsun
'northsnow注释:不知道用在何处,但是保留
'=============================================
private function geturl()
dim scriptaddress, m_itemurl, m_item
scriptaddress = cstr(request.servervariables("script_name"))&"?" '取得当前地址
if (request.querystring <> "") then
m_itemurl = ""
for each m_item in request.querystring
if instr("page",m_item)=0 then
m_itemurl = m_itemurl & m_item &"="& server.urlencode(request.querystring(""&m_item&"")) & "&"
end if
next
scriptaddress = scriptaddress & m_itemurl '取得带参数地址
end if
geturl = scriptaddress '& "page="
end function
'=============================================
' 设置 terminate 事件。
'=============================================
private sub class_terminate
'xd_rs.close
'set xd_rs=nothing
end sub
'=============================================
'showerror 错误提示
'=============================================
private sub showerror()
if str_error <> "" then
response.write("" & sw_error & "")
response.end
end if
end sub
end class
% >
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器