【www.gdgbn.com--Dom教程】


Dim domain,Url,Url1,strPage,StrPage1
Dim xmldom,SD,SITE,dimg
domain = request.QueryString("url")
if domain = "" then domain = "alixixi.com"
If Not iswww(domain) Then
response.write "<script>alert("您输入的网址无效,请重新输入!")</script>"
domain = "alixixi.com"
End if
host = "alexa.alixixi.com"
if left(domain,7)="http://" then
 domain=right(domain,len(domain)-7)
end if
if instr(domain,"/")<>0 then
 domain=left(domain,instr(domain,"/")-1)
end if
on error resume Next
Function iswww(strng)
    iswww = false
    Dim regEx, Match
    Set regEx = New RegExp
    regEx.Pattern = "^w+((-w+)|(.w+))*[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z]+$"
    regEx.IgnoreCase = True
    Set Match = regEx.Execute(strng)
    if match.count then iswww= true
End Function
Function GetPage(Path)
        t = GetBody(Path)
        GetPage=BytesToBstr(t,"UTF-8")
End function
Function GetPage2(Path)
        t = GetBody(Path)
        GetPage2=BytesToBstr(t,"GB2312")
End function
Function GetBody(url)
        on error resume next
        Set Retrieval = CreateObject("Microsoft.XMLHTTP")
        With Retrieval
        .Open "Get", url, False, "", ""
        .Send
        GetBody = .ResponseBody
        End With
        Set Retrieval = Nothing
End Function
function fget(str)
select case trim(str)
 case ""
 fget = "--"
 case else
 fget = str
end select
end function
Function BytesToBstr(body,Cset)
        dim objstream
        set objstream = Server.CreateObject("adodb.stream")
        objstream.Type = 1
        objstream.Mode =3
        objstream.Open
        objstream.Write body
        objstream.Position = 0
        objstream.Type = 2
        objstream.Charset = Cset
        BytesToBstr = objstream.ReadText
        objstream.Close
        set objstream = nothing
End Function
Function FixStr(ByVal str, ByVal start, ByVal last, ByVal n)
Dim strTemp
On Error Resume Next
If InStr(str, start) > 0 Then
Select Case n
Case 0
strTemp = Right(str, Len(str) - InStr(str, start) - Len(start) + 1)
strTemp = Left(strTemp, InStr(strTemp, last) - 1)
Case Else
strTemp = Right(str, Len(str) - InStr(str, start) + 1)
strTemp = Left(strTemp, InStr(strTemp, last) + Len(last) - 1)
End Select
Else
strTemp = ""
End If
FixStr = strTemp
End Function
Function Comma(str)
If Not(IsNumeric(str)) Or str = 0 Then
Result = 0
ElseIf Len(Fix(str)) < 4 Then
Result = str
Else
Pos = Instr(1,str,".")
If Pos > 0 Then
Dec = Mid(str,Pos)
End if
Res = StrReverse(Fix(str))
LoopCount = 1
While LoopCount <= Len(Res)
 
TempResult = TempResult + Mid(Res,LoopCount,3)
LoopCount = LoopCount + 3
If LoopCount <= Len(Res) Then
TempResult = TempResult + ","
End If
Wend
Result = StrReverse(TempResult) + Dec
End If
Comma = Result
End Function

本文来源:http://www.gdgbn.com/wangyezhizuo/16278/