GetFile.wsc 复制代码 代码如下: <BR> <![CDATA[ <BR>var Referer, Content, Data; <BR>var Stream = new ActiveXObject("ADODB.Stream"); <BR>Stream.Type = 1; <BR>function onReady() <BR>{ <BR> if(Http.readyState == 4) <BR> { <BR> Content = Http.responseText; <BR> Data = Http.responseBody; <BR> fireEvent("ondowncomplete"); <BR> Http.abort(); <BR> } <BR>} <BR>function GetFile(URL) <BR>{ <BR> Http.onreadystatechange = onReady; <BR> Http.open("GET", URL, true, "", ""); <BR> if(Referer) Http.setRequestHeader("Referer", Referer); <BR> Http.send(null); <BR>} <BR>function Save(Path) <BR>{ <BR> Stream.Open(); <BR> Stream.Write(Data); <BR> Stream.SaveToFile(Path, 2); <BR> Stream.Close(); <BR>} <BR> ]]> <BR> test.hta 复制代码 代码如下: <BR>var Down = document.createElement("Comment"); <BR>document.lastChild.lastChild.appendChild(Down); <BR>Down.style.behavior="url(GetFile.wsc)"; <BR>Down.ondowncomplete = function() <BR>{ <BR> //document.write(Down.Content); <BR> Down.Save(SaveTo.value); <BR> Go.disabled=0; <BR> alert("OK"); <BR>} <BR>function GetFile() <BR>{ <BR> Go.disabled = 1; <BR> Down.Referer = Referer.value; <BR> Down.GetFile(URL.value); <BR>} <BR> URL: Referer: SaveTo: