教你asp获取A标签下的地址和标题

    文章出自:合力绿帆    发布时间:2010-12-4

    分享到:

    VBScript code

    '==================================================

    '*函数名 : GetHrefFromContent

    '*参数说明 : html 被提取的html中A代码

    '*功能简介 : 提取这部分html代码中A标签的连接地址和名称

    '==================================================

    function GetHrefFromContent(html)

    Dim Re, match, matchs,strContent,aryNum,aryContent,strUrl

    strContent = ""

    set Re = new RegExp

    re.IgnoreCase =True

    re.Global = True

    re.Pattern = "<a.*?href=(?:""(.*?)""|(.*?))(?:(?: .*?>)|>)(.*?)</a>"

    Set matchs = re.Execute(html)

    for each match in matchs

    'match.SubMatches(0) 基本 0 可改成数组里的其它成员

    strContent = strContent + (match.SubMatches(0)) & "|$|"

    next

    set matchs = nothing

    aryContent = split(strContent,"|$|")

    for aryNum = LBound(aryContent) to UBound(aryContent)

    strUrl = aryContent(aryNum) '连接地址

    next

    end function

    文章出自:北京网站建设公司-合力绿帆 如转载请注明出处!
网站备案资料下载| FTP审请| 建设套餐|建站流程|建站合同下载|关于我们|付款方式| 联系我们