ASP代码:自动取得新闻内容标签、关键字函数

作者:青青网络 来源:未知 日期:2011-7-30 15:00:19 人气: 标签:CSS+div+js 超酷菜单
导读:源代码<%@LANGUAGE="VBSCRipT"CODEPAGE="65001"%><%optionexplicitresponse.charset="UTF-8"session.codepage=65001sessio

分享到:

源代码
<%@LANGUAGE="VBSCRipT" CODEPAGE="65001"%>
<%
option explicit
response.charset = "UTF-8"
session.codepage = 65001
session.timeout = 1440
server.scripttimeout = 9999

Function ShowTags(ByVal strTitle, ByVal strContent)
Dim xml, objNodes, XMLPath, i
strTitle = Server.URLEncode(strTitle)
strContent = Server.URLEncode(strContent)
XMLPath="http://keyWord。discuz。com/related_kw.html?title="&strTitle&"&content="&strContent&"&ics=utf-8&ocs=utf-8"
'From:http://www.code-123.com
    Set XML = server.CreateObject("Microsoft.XMLDOM")
        With XML
        .async = "false"
        .resolveExternals = "false"
        .setPRoperty "ServerHTTPRequest", true
        .load(XMLPath)
            If .getElementsByTagName("info")(0).selectSingleNode("count").Text > 0 Then
            Set objNodes = .getElementsByTagName("item")
                For i = 0 to objNodes.length - 1
                ShowTags = ShowTags & Trim(objNodes(i).selectSingleNode("kw").Text)&","
                Next
            Set objNodes = Nothing
            ShowTags = Left(ShowTags,Len(ShowTags)-1)
            Else
            ShowTags = 0
            End If
        End With
    Set XML = Nothing
End Function

'应用
Response.write ShowTags("....天空Web开发代码站ASP及其他Web开发相关经典....")
%>



上一篇:减轻负担,asp防止网页刷新代码
下一篇:正确操作MySQL数据库10种方法