记录太长。对一条记录分页的方法。谁能帮我

caiyi000 2003-06-10 05:26:35
我想对一条很长的记录进行分页,就是说。有一个记录有1000个字。我想分页显示。比如到100个字就分。还要做到智能分页,就是说有,号或者什么的时候分。不要1001个字。如果100个字分,最后一页就一个字。这样很不好。谁能帮搞定
...全文
31 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
tigerwen01 2003-06-10
  • 打赏
  • 举报
回复
《超长字符的智能分页-支持HTML》
代码如下:
--------------------------------------
'Request Form Item
I_Forder = Request.Form ("I_Folder")
I_Topic = Request.Form ("I_Topic")
I_Title = htmlencode(Request.Form ("I_Title"))
I_Body = Request.Form ("body")
I_Source = Request.Form ("I_Source")
I_Keyword= htmlencode(Request.Form ("I_Keyword"))
I_ISHOT = request.form("ishot")
if i_ishot = "" then i_ishot="N"
i_ispic = request.form("ispic")
if i_ispic = "" then i_ispic ="N"
i_pic = request.form("InsertImage")
i_body = replace(i_body,"contentEditable=true","contentEditable=false")

'Check Input
'......

'Get Pages ,B = Body
B_Len = Len(I_Body)
B_Pages = 1
'T = Temp
T_Loop = true

Do While T_Loop '这里loop多次,每4000分一页,算出页码并加入库。
If B_Len > 4000 then
N_Body = Left(I_Body,4000) 'N = New
'If "<P" in N_Body,Else ">" in N_Body
If Instrrev(N_Body,"<P") > 0 and (Len(N_Body) - Instrrev(N_Body,"<P"))< 400 then
N_Body = Left(N_Body,InstrRev(N_Body,"<P")-1)
else if Instrrev(N_Body,"  ") > 0 and (Len(N_Body) - Instrrev(N_Body,"  "))< 400 then
N_Body = Left(N_Body,InstrRev(N_Body,"  ")-1)
Else If Instrrev(N_Body,"。") > 0 and (Len(N_Body) - Instrrev(N_Body,"。"))< 400 then
N_Body = Left(N_Body,InstrRev(N_Body,"。"))
Else If Instrrev(N_Body,";") > 0 and (Len(N_Body) - Instrrev(N_Body,";"))< 400 then
N_Body = Left(N_Body,InstrRev(N_Body,";"))
else if Instrrev(N_Body,",") > 0 and (Len(N_Body) - Instrrev(N_Body,","))< 400 then
N_Body = Left(N_Body,InstrRev(N_Body,","))
else if Instrrev(N_Body,".") > 0 and (Len(N_Body) - Instrrev(N_Body,"."))< 400 then
N_Body = Left(N_Body,InstrRev(N_Body,"."))
end if
end if
End If
End If
end if
End if

N_Len = Len(N_Body)
I_Body = Mid(I_Body,N_Len+1)
B_Len = Len(I_Body)

Else
N_Body = I_Body
T_Loop = false
End If


'Add to database
Exec_prc_Content_Ins I_Forder,I_Topic,I_Title,I_Source,N_Body,i_ispic,i_pic,i_ishot,I_Keyword,B_Pages

'这里一个function,你可以自己处理,反正结果有两个,一个是body,一个是b_pages,就是页码。


B_Pages = B_Pages + 1

Loop


%>

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<link rel="stylesheet" type="text/css" href="../CSS/default.css">
</head>

<body>

<div align="center">
<center>

<table border=1 width="300" height="128" bordercolor="#000000" cellspacing="0" cellpadding="0" style="border-collapse: collapse"><tr>
<td bgcolor="#DEDBD6" height="31">
录入成功</td></tr><tr><td height="96">
<p align="center">此文章共分<%=B_Pages-1%>页
</td></tr></table>


</center>
</div>
<script>
top.main_top.location.reload();
</script>

</body>

这肯定是你想要的。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧