html的标签怎么转换?

沧海小鱼 2007-06-09 01:50:48
'声明截取的格式,从Start开始截取,到Last为结束
Function GetKey(HTML,Start,Last)
filearray=split(HTML,Start)
If UBound(filearray)>0 Then
filearray2=split(filearray(1),Last)
If UBound(filearray2)>0 Then
GetKey=filearray2(0)
Else
GetKey=""
End IF
Else
GetKey=""
End IF
End Function


product_Name = GetKey(Html,product_Name_start,product_Name_end) '获取商品名称
一旦从数据库里取出<title>就获取不了,数据库里值为<title>文本类型
下面这个就可以,我该这么转换下呢?
product_Name = GetKey(Html,"<title>","</title>")

...全文
348 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
沧海小鱼 2007-06-11
  • 打赏
  • 举报
回复
在顶一次
沧海小鱼 2007-06-10
  • 打赏
  • 举报
回复
顶出来 帮忙截取页面标题
product_Name=GetKey(Html,"<title>","</title>") 我直接写title可以截取
当换成把title写进数据库在取出来的时候就不能截取了
GetKey(Html,product_Name_start,product_Name_end)
沧海小鱼 2007-06-09
  • 打赏
  • 举报
回复
请麻烦看清楚我的问题,谢谢你的帮助

我内容还没放进去呢 只不过数据库里存取的是要截取的开始位置和结束位置

开始<title>
结束</title>
当从数据库里取出来的时候 就截取不到值了,我想是HTML标签的属性造成的,但不知道这么解决
badwish 2007-06-09
  • 打赏
  • 举报
回复
计取的时候你的字段放的已经是<title></title>这间的内容了呀?因为里面不再含有<title>、</title>因此你再用getkey这个函数时取了个空值。
沧海小鱼 2007-06-09
  • 打赏
  • 举报
回复
我现在是获取一个网页的标题 就是<title></title>之间的内容
当我用product_Name = GetKey(Html,"<title>","</title>") 这个时可以得到值
但是一旦把<title>写进数据库在取出来动态获取,照下面的格式
product_Name = GetKey(Html,product_Name_start,product_Name_end)
就得不到值了

怎么回事?
badwish 2007-06-09
  • 打赏
  • 举报
回复
楼主要是的这样的吗?
楼主说的好难理解。。。。
嘿嘿,正则我还用不好,瞎写的。。

str="<title>是要取这里的值吗?</title>"
response.write(getkey(str))

function GetKey(str)
if str<>"" then
dim re,return
set re=new regexp
re.pattern="<title>([^(<|>)]*?)</title>"
if re.test(str) then return=replace(replace(str,"<title>",""),"</title>","") else return=""
set re=nothing
else
return=""
end if
getkey=return
end function

28,409

社区成员

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

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