内容自动分页函数调用
来源:互联网 发布:淘宝金酷娃玩具洒水车 编辑:程序博客网 时间:2024/06/05 10:00
'**************************************************
'函 数 名:AutoShowContentPage(requestid,requestcontent,filename)
'作 用:内容自动分页函数调用
'参数说明:filename-当前显示页面文件名称
'*************************************************
Function AutoShowContentPage(requestid,requestcontent,filename)
dim NewsID,strContent,CurrentPage,str2
dim ContentLen,MaxPerPage,pages,i,lngBound
dim BeginPoint,EndPoint,MaxPerPage_Content,ShowContentByPage
ShowContentByPage="Yes" '新闻内容是否分页显示
MaxPerPage_Content=2500 '每页显示大约字符数
NewsID=requestid
strContent=requestcontent
ContentLen=len(strContent)
CurrentPage=trim(request.querystring("showpage"))
if ShowContentByPage="No" or ContentLen<=MaxPerPage_Content then
str2=strContent
if ShowContentByPage="Yes" then
str2=str2+""
end if
else
if CurrentPage="" then
CurrentPage=1
else
CurrentPage=Cint(CurrentPage)
end if
pages=ContentLen/MaxPerPage_Content
if MaxPerPage_Content*pages<ContentLen then
pages=pages+1
end if
lngBound=MaxPerPage_Content '最大误差范围
if CurrentPage<1 then CurrentPage=1
if CurrentPage>pages then CurrentPage=pages
dim lngTemp
dim lngTemp1,lngTemp1_1,lngTemp1_2,lngTemp1_1_1
dim lngTemp1_1_2,lngTemp1_1_3,lngTemp1_2_1,lngTemp1_2_2,lngTemp1_2_3
dim lngTemp2,lngTemp2_1,lngTemp2_2,lngTemp2_1_1,lngTemp2_1_2,lngTemp2_2_1,lngTemp2_2_2
dim lngTemp3,lngTemp3_1,lngTemp3_2,lngTemp3_1_1,lngTemp3_1_2,lngTemp3_2_1,lngTemp3_2_2
dim lngTemp4,lngTemp4_1,lngTemp4_2,lngTemp4_1_1,lngTemp4_1_2,lngTemp4_2_1,lngTemp4_2_2
dim lngTemp5,lngTemp5_1,lngTemp5_2
dim lngTemp6,lngTemp6_1,lngTemp6_2
if CurrentPage=1 then
BeginPoint=1
else
BeginPoint=MaxPerPage_Content*(CurrentPage-1)+1
lngTemp1_1_1=instr(BeginPoint,strContent,"</table>",1)
lngTemp1_1_2=instr(BeginPoint,strContent,"</TABLE>",1)
lngTemp1_1_3=instr(BeginPoint,strContent,"</Table>",1)
if lngTemp1_1_1>0 then
lngTemp1_1=lngTemp1_1_1
elseif lngTemp1_1_2>0 then
lngTemp1_1=lngTemp1_1_2
elseif lngTemp1_1_3>0 then
lngTemp1_1=lngTemp1_1_3
else
lngTemp1_1=0
end if
lngTemp1_2_1=instr(BeginPoint,strContent,"<table",1)
lngTemp1_2_2=instr(BeginPoint,strContent,"<TABLE",1)
lngTemp1_2_3=instr(BeginPoint,strContent,"<Table",1)
if lngTemp1_2_1>0 then
lngTemp1_2=lngTemp1_2_1
elseif lngTemp1_2_2>0 then
lngTemp1_2=lngTemp1_2_2
elseif lngTemp1_2_3>0 then
lngTemp1_2=lngTemp1_2_3
else
lngTemp1_2=0
end if
if lngTemp1_1=0 and lngTemp1_2=0 then
lngTemp1=BeginPoint
else
if lngTemp1_1>lngTemp1_2 then
lngtemp1=lngTemp1_2
else
lngTemp1=lngTemp1_1+8
end if
end if
lngTemp2_1_1=instr(BeginPoint,strContent,"</p>",1)
lngTemp2_1_2=instr(BeginPoint,strContent,"</P>",1)
if lngTemp2_1_1>0 then
lngTemp2_1=lngTemp2_1_1
elseif lngTemp2_1_2>0 then
lngTemp2_1=lngTemp2_1_2
else
lngTemp2_1=0
end if
lngTemp2_2_1=instr(BeginPoint,strContent,"<p",1)
lngTemp2_2_2=instr(BeginPoint,strContent,"<P",1)
if lngTemp2_2_1>0 then
lngTemp2_2=lngTemp2_2_1
elseif lngTemp2_2_2>0 then
lngTemp2_2=lngTemp2_2_2
else
lngTemp2_2=0
end if
if lngTemp2_1=0 and lngTemp2_2=0 then
lngTemp2=BeginPoint
else
if lngTemp2_1>lngTemp2_2 then
lngtemp2=lngTemp2_2
else
lngTemp2=lngTemp2_1+4
end if
end if
lngTemp3_1_1=instr(BeginPoint,strContent,"</ur>",1)
lngTemp3_1_2=instr(BeginPoint,strContent,"</UR>",1)
if lngTemp3_1_1>0 then
lngTemp3_1=lngTemp3_1_1
elseif lngTemp3_1_2>0 then
lngTemp3_1=lngTemp3_1_2
else
lngTemp3_1=0
end if
lngTemp3_2_1=instr(BeginPoint,strContent,"<ur",1)
lngTemp3_2_2=instr(BeginPoint,strContent,"<UR",1)
if lngTemp3_2_1>0 then
lngTemp3_2=lngTemp3_2_1
elseif lngTemp3_2_2>0 then
lngTemp3_2=lngTemp3_2_2
else
lngTemp3_2=0
end if
if lngTemp3_1=0 and lngTemp3_2=0 then
lngTemp3=BeginPoint
else
if lngTemp3_1>lngTemp3_2 then
lngtemp3=lngTemp3_2
else
lngTemp3=lngTemp3_1+5
end if
end if
if lngTemp1<lngTemp2 then
lngTemp=lngTemp2
else
lngTemp=lngTemp1
end if
if lngTemp<lngTemp3 then
lngTemp=lngTemp3
end if
if lngTemp>BeginPoint and lngTemp<=BeginPoint+lngBound then
BeginPoint=lngTemp
else
lngTemp4_1_1=instr(BeginPoint,strContent,"</li>",1)
lngTemp4_1_2=instr(BeginPoint,strContent,"</LI>",1)
if lngTemp4_1_1>0 then
lngTemp4_1=lngTemp4_1_1
elseif lngTemp4_1_2>0 then
lngTemp4_1=lngTemp4_1_2
else
lngTemp4_1=0
end if
lngTemp4_2_1=instr(BeginPoint,strContent,"<li",1)
lngTemp4_2_1=instr(BeginPoint,strContent,"<LI",1)
if lngTemp4_2_1>0 then
lngTemp4_2=lngTemp4_2_1
elseif lngTemp4_2_2>0 then
lngTemp4_2=lngTemp4_2_2
else
lngTemp4_2=0
end if
if lngTemp4_1=0 and lngTemp4_2=0 then
lngTemp4=BeginPoint
else
if lngTemp4_1>lngTemp4_2 then
lngtemp4=lngTemp4_2
else
lngTemp4=lngTemp4_1+5
end if
end if
if lngTemp4>BeginPoint and lngTemp4<=BeginPoint+lngBound then
BeginPoint=lngTemp4
else
lngTemp5_1=instr(BeginPoint,strContent,"<img",1)
lngTemp5_2=instr(BeginPoint,strContent,"<IMG",1)
if lngTemp5_1>0 then
lngTemp5=lngTemp5_1
elseif lngTemp5_2>0 then
lngTemp5=lngTemp5_2
else
lngTemp5=BeginPoint
end if
if lngTemp5>BeginPoint and lngTemp5<BeginPoint+lngBound then
BeginPoint=lngTemp5
else
lngTemp6_1=instr(BeginPoint,strContent,"<br>",1)
lngTemp6_2=instr(BeginPoint,strContent,"<BR>",1)
if lngTemp6_1>0 then
lngTemp6=lngTemp6_1
elseif lngTemp6_2>0 then
lngTemp6=lngTemp6_2
else
lngTemp6=0
end if
if lngTemp6>BeginPoint and lngTemp6<BeginPoint+lngBound then
BeginPoint=lngTemp6+4
end if
end if
end if
end if
end if
if CurrentPage=pages then
EndPoint=ContentLen
else
EndPoint=MaxPerPage_Content*CurrentPage
if EndPoint>=ContentLen then
EndPoint=ContentLen
else
lngTemp1_1_1=instr(EndPoint,strContent,"</table>",1)
lngTemp1_1_2=instr(EndPoint,strContent,"</TABLE>",1)
lngTemp1_1_3=instr(EndPoint,strContent,"</Table>",1)
if lngTemp1_1_1>0 then
lngTemp1_1=lngTemp1_1_1
elseif lngTemp1_1_2>0 then
lngTemp1_1=lngTemp1_1_2
elseif lngTemp1_1_3>0 then
lngTemp1_1=lngTemp1_1_3
else
lngTemp1_1=0
end if
lngTemp1_2_1=instr(EndPoint,strContent,"<table",1)
lngTemp1_2_2=instr(EndPoint,strContent,"<TABLE",1)
lngTemp1_2_3=instr(EndPoint,strContent,"<Table",1)
if lngTemp1_2_1>0 then
lngTemp1_2=lngTemp1_2_1
elseif lngTemp1_2_2>0 then
lngTemp1_2=lngTemp1_2_2
elseif lngTemp1_2_3>0 then
lngTemp1_2=lngTemp1_2_3
else
lngTemp1_2=0
end if
if lngTemp1_1=0 and lngTemp1_2=0 then
lngTemp1=EndPoint
else
if lngTemp1_1>lngTemp1_2 then
lngtemp1=lngTemp1_2-1
else
lngTemp1=lngTemp1_1+7
end if
end if
lngTemp2_1_1=instr(EndPoint,strContent,"</p>",1)
lngTemp2_1_2=instr(EndPoint,strContent,"</P>",1)
if lngTemp2_1_1>0 then
lngTemp2_1=lngTemp2_1_1
elseif lngTemp2_1_2>0 then
lngTemp2_1=lngTemp2_1_2
else
lngTemp2_1=0
end if
lngTemp2_2_1=instr(EndPoint,strContent,"<p",1)
lngTemp2_2_2=instr(EndPoint,strContent,"<P",1)
if lngTemp2_2_1>0 then
lngTemp2_2=lngTemp2_2_1
elseif lngTemp2_2_2>0 then
lngTemp2_2=lngTemp2_2_2
else
lngTemp2_2=0
end if
if lngTemp2_1=0 and lngTemp2_2=0 then
lngTemp2=EndPoint
else
if lngTemp2_1>lngTemp2_2 then
lngTemp2=lngTemp2_2-1
else
lngTemp2=lngTemp2_1+3
end if
end if
lngTemp3_1_1=instr(EndPoint,strContent,"</ur>",1)
lngTemp3_1_2=instr(EndPoint,strContent,"</UR>",1)
if lngTemp3_1_1>0 then
lngTemp3_1=lngTemp3_1_1
elseif lngTemp3_1_2>0 then
lngTemp3_1=lngTemp3_1_2
else
lngTemp3_1=0
end if
lngTemp3_2_1=instr(EndPoint,strContent,"<ur",1)
lngTemp3_2_2=instr(EndPoint,strContent,"<UR",1)
if lngTemp3_2_1>0 then
lngTemp3_2=lngTemp3_2_1
elseif lngTemp3_2_2>0 then
lngTemp3_2=lngTemp3_2_2
else
lngTemp3_2=0
end if
if lngTemp3_1=0 and lngTemp3_2=0 then
lngTemp3=EndPoint
else
if lngTemp3_1>lngTemp3_2 then
lngtemp3=lngTemp3_2-1
else
lngTemp3=lngTemp3_1+4
end if
end if
if lngTemp1<lngTemp2 then
lngTemp=lngTemp2
else
lngTemp=lngTemp1
end if
if lngTemp<lngTemp3 then
lngTemp=lngTemp3
end if
if lngTemp>EndPoint and lngTemp<=EndPoint+lngBound then
EndPoint=lngTemp
else
lngTemp4_1_1=instr(EndPoint,strContent,"</li>",1)
lngTemp4_1_2=instr(EndPoint,strContent,"</LI>",1)
if lngTemp4_1_1>0 then
lngTemp4_1=lngTemp4_1_1
elseif lngTemp4_1_2>0 then
lngTemp4_1=lngTemp4_1_2
else
lngTemp4_1=0
end if
lngTemp4_2_1=instr(EndPoint,strContent,"<li",1)
lngTemp4_2_1=instr(EndPoint,strContent,"<LI",1)
if lngTemp4_2_1>0 then
lngTemp4_2=lngTemp4_2_1
elseif lngTemp4_2_2>0 then
lngTemp4_2=lngTemp4_2_2
else
lngTemp4_2=0
end if
if lngTemp4_1=0 and lngTemp4_2=0 then
lngTemp4=EndPoint
else
if lngTemp4_1>lngTemp4_2 then
lngtemp4=lngTemp4_2-1
else
lngTemp4=lngTemp4_1+4
end if
end if
if lngTemp4>EndPoint and lngTemp4<=EndPoint+lngBound then
EndPoint=lngTemp4
else
lngTemp5_1=instr(EndPoint,strContent,"<img",1)
lngTemp5_2=instr(EndPoint,strContent,"<IMG",1)
if lngTemp5_1>0 then
lngTemp5=lngTemp5_1-1
elseif lngTemp5_2>0 then
lngTemp5=lngTemp5_2-1
else
lngTemp5=EndPoint
end if
if lngTemp5>EndPoint and lngTemp5<EndPoint+lngBound then
EndPoint=lngTemp5
else
lngTemp6_1=instr(EndPoint,strContent,"<br>",1)
lngTemp6_2=instr(EndPoint,strContent,"<BR>",1)
if lngTemp6_1>0 then
lngTemp6=lngTemp6_1+3
elseif lngTemp6_2>0 then
lngTemp6=lngTemp6_2+3
else
lngTemp6=EndPoint
end if
if lngTemp6>EndPoint and lngTemp6<EndPoint+lngBound then
EndPoint=lngTemp6
end if
end if
end if
end if
end if
end if
str2= mid(strContent,BeginPoint,EndPoint-BeginPoint)
str2=str2+ "</p><p align='center'>"
if CurrentPage>1 then
str2=str2+ "<a href='"&filename&".asp?id="&NewsID&"&showpage="&CurrentPage-1&"'>上一页</a> "
end if
for i=1 to pages
if i=CurrentPage then
str2=str2+ "<span class='key_font'>["&cstr(i)&"]</span> "
else
str2=str2+ "<a href='"&filename&".asp?id="&NewsID&"&showpage="&i&"'>["&i&"]</a> "
end if
next
if CurrentPage<pages then
str2=str2+ " <a href='"&filename&".asp?id="&NewsID&"&showpage="&CurrentPage+1&"'>下一页</a>"
end if
str2=str2+ "</p>"
end if
AutoShowContentPage=str2
end function
- 内容自动分页函数调用
- 函数调用中栈帧内容
- Html内容分页处理函数
- 长内容的新闻进行自动分页
- Discuz 用专题与DIY实现调用指定内容并且自动按要求分页的单页
- js 自动调用函数
- 函数自动调用
- 函数调用栈桢内容
- 9、自动调用在线翻译进行内容翻译
- ASP长文章内容自动分页函数
- VB.Net 开发的长内容自动分页功能
- 在asp.net中长内容自动分页的实现
- .net 开发的长内容自动分页功能(VB)
- 在asp.net中长内容自动分页的实现
- VB.Net 开发的长内容自动分页功能
- asp.net中长内容自动分页的实现
- 在ASP.Net中长内容自动分页的实现
- asp.net中长内容自动分页的实现
- JAVA的字符串拼接与性能
- 框架表示法
- 继续研究uboot-led篇
- ${pageContext.request.contextPath}的作用
- struct device浅析
- 内容自动分页函数调用
- elf2flt的含义
- VB中的API详解
- MFC For WinCE不支持的类
- 适合初学者的题目(1)---浙大acm online judge
- linux 通道流
- 用于场景恢复的函数
- 鹅鹅鹅
- Linux字符设备驱动程序编写基本流程