DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> AJAX入門 >> AJAX詳解 >> 用XMlhttp生成html頁面
用XMlhttp生成html頁面
編輯:AJAX詳解     

<%'定義XMLhttp
function GetXMLText(Url)
dim GetXMLHttp

set GetXmlHttp=server.Createobject("Microsoft.XMLHTTP")
GetXMLHttp.open "Get",url,false,"",""
GetXMLHttp.Send
'GetXmlText=GetXMLHttp.Responsetext
GetXmlText=GetXMLHttp.ResponseBody
set GetXMLHttp=nothing
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

'保存文件
Sub SaveToFile(strBody,File)
    Dim obJStream
    Set obJStream = Server.CreateObject("ADODB.Stream")
    With obJStream
        .Type = 2
        .Open
        .Charset = "GB2312"
        .Position = obJStream.Size
  .WriteText = strBody
        .SaveToFile Server.MapPath(File),2
        .Close
    End With
    Set obJStream = Nothing
End Sub
%>

<% SaveFile BytesToBstr(GetXMLText("http://127.0.0.1/index.ASP"),"GB2312"),"index.htm"%>

 

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved