第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

asp怎樣去除文章中的html代碼?

asp怎樣去除文章中的html代碼?

我的asp網(wǎng)站想從數(shù)據(jù)庫(kù)中讀取一片文章然后截取前100個(gè)文字,但是文章是帶有格式的,簡(jiǎn)單的用left函數(shù)會(huì)截取部分代碼,導(dǎo)致格式錯(cuò)亂。請(qǐng)高人指點(diǎn)迷津:例如:將<p><font style="color:red">我的問(wèn)題誰(shuí)來(lái)解決</font></p>變?yōu)椋何业膯?wèn)題誰(shuí)來(lái)解決請(qǐng)不要用replace函數(shù)枚舉代碼而替換之。
查看完整描述

3 回答

?
慕斯王

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超2個(gè)贊

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
sitePath="data.mdb"
dim conn
set conn=server.CreateObject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0; data source="&server.mappath("/"&sitePath)

set rs=server.CreateObject("adodb.recordset")
sql="select * from Aspcms_News where NewsID=5 "
rs.open sql,conn,1,1
if not rs.eof then
numbers=len(rs("content")) '總字節(jié)數(shù)
pagenum=900 '每頁(yè)顯示的數(shù)量
maxpage=-int(-numbers/pagenum)'總頁(yè)數(shù)
requestpage=clng(request("p"))'接收頁(yè)碼
if requestpage="" or requestpage=0 then'獲取默認(rèn)頁(yè)碼
requestpage=1
end if
if requestpage>maxpage then '當(dāng)前頁(yè)的頁(yè)碼大于最大頁(yè)碼時(shí),使當(dāng)前頁(yè)碼等于最大頁(yè)碼
requestpage=maxpage
end if
if not requestpage=1 then '當(dāng)前頁(yè)碼不等于1時(shí),向下移動(dòng)相應(yīng)的字節(jié)數(shù)
content=mid(rs("Content"),(requestpage-1)*pagenum+1,900)
else
content=left(rs("Content"),900) '當(dāng)頁(yè)碼等于1時(shí),截取相應(yīng)文本
end if

if isempty(requestpage) then
thispage=1
else
thispage=cint(requestpage)
end if
%>

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>對(duì)超長(zhǎng)文本數(shù)據(jù)進(jìn)行分頁(yè)顯示</title>
</head>

<body >
<table width="470" border="0" cellspacing="0">
<tr>
<td height="33"><div align="center"><strong><%=rs("Title")%></strong></div></td>
</tr>
<tr>
<td> <font size="2"><%' =content%><%=Replace(content,chr(13),"<br>")%></font></td>
</tr>
<tr>
<td align="right">
<font size="2">總頁(yè)數(shù):<%=maxpage%> 當(dāng)前頁(yè):<%=requestpage%> <a href="content_page.asp?p=1">第一頁(yè)</a> <a href="content_page.asp?p=<%=(requestpage-1)%>">上一頁(yè)</a> <a href="content_page.asp?p=<%=(requestpage+1)%>">下一頁(yè)</a> <a href="content_page.asp?p=<%=maxpage%>">最后一頁(yè)</a></font>
</td>
</tr>
<tr>
<td align="right">
<%for i=1 to maxpage
if thispage=i then
response.write ""&i&" "
else %>
[<a href="content_page.asp?p=<%=i%>"><%=i%></a>]
<% end if %>
<%next%>
</td>
</tr> </table>
<%
else
response.Write("沒(méi)有內(nèi)容")
end if
%>
</body></html>

我參考的這個(gè)代碼,可以正常分頁(yè),卻有html代碼



查看完整回答
反對(duì) 回復(fù) 2019-03-26
  • 3 回答
  • 0 關(guān)注
  • 606 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)