<script language="javascript"> function URLDownloadToFile(sURL, sFilePath) { var adTypeBinary = 1; var adSaveCreateOverWrite = 2; var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.open("GET",sURL,false); xmlhttp.send(); if (xmlhttp.status != 200) { alert("something is wrong:" + xmlhttp.statusText); } else { var stream = new ActiveXObject("ADODB.Stream"); stream.type = adTypeBinary; stream.open(); stream.write(xmlhttp.responseBody); stream.saveToFile(sFilePath, adSaveCreateOverWrite); stream.close(); stream = null; } xmlhttp = null; }function window.onload() { //you should set the url to your web server onlyURLDownloadToFile("http://localhost/test/xml-wellformed.zip","c:/temp/ml-wellformed.zip"); } </script>
http://www.china-pub.com/computers/emook/wzq/044/info.htm
function URLDownloadToFile(sURL, sFilePath)
{
var adTypeBinary = 1;
var adSaveCreateOverWrite = 2; var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET",sURL,false);
xmlhttp.send();
if (xmlhttp.status != 200)
{
alert("something is wrong:" + xmlhttp.statusText);
}
else
{
var stream = new ActiveXObject("ADODB.Stream");
stream.type = adTypeBinary;
stream.open();
stream.write(xmlhttp.responseBody);
stream.saveToFile(sFilePath, adSaveCreateOverWrite);
stream.close();
stream = null;
} xmlhttp = null;
}function window.onload()
{
//you should set the url to your web server onlyURLDownloadToFile("http://localhost/test/xml-wellformed.zip","c:/temp/ml-wellformed.zip");
}
</script>