<% dim totaltext,templinenum,pnum dim a,b,c dim w,h,pagecounter function pagetext(str) w = 43 h = 17 totaltext = split(str,"<br>") templinenum = 0 pagecounter = 1 if cint(request("pcounter"))<=0 or len(request("pcounter"))=0 or isnull(request("pcounter")) or isempty(request("pcounter")) then pnum=1 else pnum=cint(trim(request("pcounter"))) end if for a = 0 to ubound(totaltext) if (len(totaltext(a)) mod w) <> 0 or len(totaltext(a)) = 0 then templinenum = templinenum + len(totaltext(a))w+1 else templinenum = templinenum + len(totaltext(a))w end if if pnum = pagecounter then 'response.write "<font color=red>"&pagecounter&"_"&templinenum&"</font>" response.write totaltext(a) & "<br>" end if if templinenum > h then templinenum = 0 if a < ubound(totaltext) then pagecounter = pagecounter + 1 end if next if pnum <= 0 or pnum > pagecounter then response.write "您所查询的信息超出范围,请谨慎操作!" pagetext="" end function %> <% sql="select * from news where id="&cint(request("id")) rs.open sql,conn,3,3 if rs.eof then response.write "您所查询的新闻不存在!" else %> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="21" align="center" background="images/xuxian2.gif" class="zhengwen"> <span class="darkred_bold"><%=rs("title")%></span> </td> </tr> <tr> <td background="images/xuxian2.gif" class="zhengwen"> <% sql="select * from newspic where parent="&cint(request("id"))" order by orders,id desc" rs2.open sql,conn,1,1 if rs2.eof then pagetext(rs("text")) else 'news with pictures response.write "<img src="&rs2("pic")" width=250 height=165 border=0>" pagetext(rs("text")) end if rs2.close %> </td> </tr> </table> <% if pagecounter>1 then %> <table width="98%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" height="25" align="left"> <% if pnum=1 then response.write "<span class='arrow'>7 3</span> " else response.write "<a href=news.asp?id="&request("id")"&pcounter=1 class='black'><span class='arrow' title='第1页'>7</span></a> <a href=news.asp?id="&request("id")"&pcounter="&cint(pnum-1)" class='black' title='第"&cint(pnum-1)"页'><span class='arrow'>3</span></a> " end if if pnum=pagecounter then response.write "<span class='arrow'>4 8</span>" else response.write "<a href=news.asp?id="&request("id")"&pcounter="&cint(pnum+1)" class='black' title='第"&cint(pnum+1)"页'><span class='arrow'>4</span></a> <a href=news.asp?id="&request("id")"&pcounter="&pagecounter" class='black' title='第"&pagecounter"页'><span class='arrow'>8</span></a>" end if %> </td> <form name="form1" method="post" action="news.asp?id=<%=request("id")%>"> <td width="50%" height="25" align="right"> 转到第 <input name="pcounter" type="text" size="1" style="border:1px solid #cccccc;margin=0px"> 页 </td> </form> </tr> <tr> <td height="25" colspan="2"> 第 <%=pnum %> 页,共 <%=pagecounter %> 页 </td> </tr> </table> <% end if %> <% end if rs.close %>