如:
<IMG height=197 src="http://www.51maibang.com/cn/image/news/44623102006163512_4.gif" width=550 align=middle border=0><BR><BR> 随着消费者保健意识的加强和日常消费需求的上升,中国功能饮料市场进入了新的发展阶段,功能饮料产业已成为中国饮料行业的亮点之一
我只想提取:随着消费者保健意识的加强和日常消费需求的上升,中国功能饮料市场进入了新的发展阶段,功能饮料产业已成为中国饮料行业的亮点之一。
如果用replace,它只会把如"<"等替换掉,不能替换"height"等字符,总不能让我用replace把所有HTML的代码全写一遍吧。
望高手指教。
參考答案:我提供我自己定的一个函数你
function delhtml(strtemp)
if len(trim(strtemp))>0 then
strtemp=replace(strtemp,"<p>","
")
strtemp=replace(strtemp,"<P>","
")
strtemp=replace(strtemp,"</P>","")
strtemp=replace(strtemp,"<br>","
")
strtemp=replace(strtemp,"<BR>","
")
while instr(strtemp,"<")>0 and instr(strtemp,">")>0
pos=instr(strtemp,"<")
pos2=instr(strtemp,">")
killstr=mid(strtemp,pos,pos2-pos+1)
strtemp=replace(strtemp,killstr,"")
wend
strtemp=replace(strtemp,"
","<br>")
strtemp=replace(strtemp,"<br><br>","")
end if
delhtml=strtemp
end function
使用方法:
str="<IMG height=197 src='' width=550 align=middle border=0><BR><BR> 随着消费者保健意识的加强和日常消费需求的上升,中国功能饮料市场进入了新的发展阶段,功能饮料产业已成为中国饮料行业的亮点之一"
str=delhtml(str)
response.write str