第一种
<%@ page contentType="text/html; charset=gb2312"%>
<%@ include file="/DataIni/DataOpen.jsp"%>
<%@ include file="/ScriptLib/Init.jsp"%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<link rel="stylesheet" type="text/css" href="/StyleLib/Default_Style_Sheet.css">
</head>
<body>
<%//@ include file="/TemplateLib/Wsh.jsp"%>
<%@ include file="/TemplateLib/Head.jsp"%>
<center>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="80%">    
  <tr>
    <td width="100%" valign="top">测试XMLHTTP</td>
  </tr>
</table>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="80%">    
  <tr>
    <td width="100%" valign="top">
<input type="text" value="http://10.70.38.10:9002/System/Dot/Show.jsp?Id=1" id="URLID">
<input type="text" value="C:\\DownURL.doc" id="LocalURLID">
<input type="button" value="下载" onclick="DownURL(URLID.value,LocalURLID.value);">
    </td>
  </tr>
</table>
<br>
<div id=App style="border:1 solid #000000;background-color:#FFFFFF;height:200px;overflow:auto;width:80%;z-index:2" contentEditable></div>
<script>
function OpenFile(strFileName)
{
try
{
var WordApp=new ActiveXObject("Word.Application");
WordApp.Application.Visible=false;
var Doc=WordApp.Documents.Open(strFileName);
Doc.Activate();
Doc.Parent.Options.InsertedTextColor=4;
Doc.Parent.Options.InsertedTextMark=2;
Doc.Parent.Options.DeletedTextColor=4;
Doc.Parent.Options.DeletedTextMark=1;
Doc.TrackRevisions=true;
Doc.PrintRevisions=true;
Doc.ShowRevisions=true;
Doc.Application.UserName="";
var Range=Doc.Range();
Range.Select();
var Selection=WordApp.Selection;
Selection.Copy();
App.focus();
document.execCommand("Paste");
App.focus();
WordApp.DisplayAlerts=false;
Doc.Close();
WordApp.DisplayAlerts=true;
WordApp.Quit();
}
catch(e)
{
window.confirm(e);
}
}
function DownURL(strRemoteURL,strLocalURL)
{
try
{
var xmlHTTP=new ActiveXObject("Microsoft.XMLHTTP");
xmlHTTP.open("Get",strRemoteURL,false);
xmlHTTP.send();
var adodbStream=new ActiveXObject("ADODB.Stream");
adodbStream.Type=1;//1=adTypeBinary
adodbStream.Open();
adodbStream.write(xmlHTTP.responseBody);
adodbStream.SaveToFile(strLocalURL,2);
adodbStream.Close();
adodbStream=null;
xmlHTTP=null;
OpenFile(strLocalURL);
}
catch(e)
{
window.confirm("下载URL出错!");
}
//window.confirm("下载完成.");
}
</script>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="80%">    
  <tr>
    <td width="100%" valign="top">测试XMLHTTP</td>
  </tr>
</table>
</br>
</center>
<%@ include file="/TemplateLib/Tail.jsp"%>
<%@ include file="/DataIni/DataClose.jsp"%>
</body></html>

解决方案 »

  1.   

    第二种
    <object type="application/x-oleobject" codebase="Exe.exe#version=1,1,1,1"></object>
    <br>
    注:Exe.exe为利用WinRAR生成的自解压文件.
    利用WinRAR实现网上程序的自动下载利用WinRAR的自解压功能实现网上程序的自动下载把需要下载的程序打包制作成一个可执行程序,等程序下载到客户机上时再自动解包,就能实现上述要求.WinRAR不但压缩率高,而且可以很容易制作自动解压缩的EXE文件包.另外,通过一个"注释文件"(RAR压缩包专用的.txt文件),还可以设定下载后解压的目标路径、创建快捷方式、版本信息等等.从而实现自动、隐蔽、快速、傻瓜化的安装程序到用户桌面的目的.程序实现
    从命令行可以运行WinRAR命令,常规的命令行语法描述如下:WinRAR  <命令> -<开关1> -<开关N> <压缩文件> <文件...> <@列表文件...> <解压路径\>详细的命令、开关等参数开查阅WinRAR的帮助.创建WinRAR自解压文件
    创建C:\Test文件夹(这里仅做测试用,你可以在任何地方创建)
    在C:\Test中创建APP目录,里面放置需要打包的程序.
    创建Test.bat批处理文件.编辑Test.bat文件,输入:C:\Progra~1\WinRAR\winrar.exe a -sfx -ep1 -ag -m5 WebTax c:\Test\APPREM 添加注释C:\Progra~1\WinRAR\winrar.exe c -zc:\Test\inf.txt c:\Test\*.exe创建Inf.txt.Inf.txt内容如下:Title=XXX系统Text{    系统描述和版权信息等等}Path=C:\Program Files\SavePathSetup=C:\Progra~1\APP\First.exeSilent=1Overwrite=1Shortcut=D,C:\Program Files\APP\Login.htm,,XXX系统,XXX系统 重要的几个参数是:
    path  表示解压目标路径;Setup 表示解压完毕后首先运行的程序.Silent 设为1时,不显示WinRAR窗口,可以做到解压的隐蔽性.Overwrite 是否覆盖原有的程序文件,设为1.Shortcut   在用户桌面创建快捷方式
      

  2.   

    第三种
    利用ActiveX打包下载
    <object id=DWebOffice style="left: 0px; width: 100%; top: 0px; height: 450px;" classid="clsid:05430EC0-69CA-437A-B1F9-4B78B8647BEA" viewastext codebase="http://10.70.38.10:9001/ActiveX/WebOffice.cab#version=1,0,0,3">创建PVK文件[私人密匙文件]makecert -sk DigitalTitan DigitalTitan.pvk
    makecert -n CN=TelStar TelStar创建CER文件[公司证书]makecert -sk DigitalTitan.pvk TelStar.cer创建SPC测试软件出版商证明书cert2spc root.cer TelStar.cer TelStar.spc创建INF文件[version]
    signature="$CHINA$"
    AdvancedINF=2.0[Add.Code]
    WebOffice.ocx=WebOffice.ocx
    mfc70.dll=mfc70.dll
    msvcrt.dll=msvcrt.dll
    olepro32.dll=olepro32.dll[mfc70.dll]
    file-win32-x86=thiscab
    FileVersion=7,0,9466,0
    DestDir=11
    RegisterServer=yes[msvcrt.dll]
    file-win32-x86=thiscab
    FileVersion=6,1,9844,0
    DestDir=11
    RegisterServer=yes[olepro32.dll]
    file-win32-x86=thiscab
    FileVersion=5,0,4522,0
    DestDir=11
    RegisterServer=yes[WebOffice.ocx]
    file-win32-x86=thiscab
    clsid={05430EC0-69CA-437A-B1F9-4B78B8647BEA} 
    FileVersion=1,0,0,1
    RegisterServer=yes
    ;创建CAB文件
    cabarc -s 6144 n WebOffice.cab msvcrt.dll msvcp70.dll msvcr70.dll mfc70.dll olepro32.dll ASYCFILT.DLL STDOLE2.TLB WebOffice.ocx WebOffice.inf使用Code Signing Wizard签署一个CAB文件
    SIGNCODE.exe
    时间戳服务:verisign的时间服务器,这个是免费的.
    http://timestamp.verisign.com/scripts/timstamp.dll另:
    makeCert -sk DigitalTitanKey -n "CN=TelStar" -ss TelStar TelStar.cer
    makecert -is TelStar -ic TelStar.cer -ss TelStarCompany.cerCert2SPC MyCert.cer MyCert.spc