Kab*_*lam 9 javascript vbscript asp-classic
有这个Excel文件,我希望用户能够从我的服务器下载.单击"下载"按钮后,必须有一种简单的方法来启动文件下载...但我不知道如何实现这一点.
到目前为止我有这个:(VBscript和ASP)
<head>
<script type="text/javascript" src="overzicht.js"></script>
</head>
Set fs=Server.CreateObject("Scripting.FileSystemObject")
if (fs.FileExists("c:\file.xls"))=true then 'fake filename D:
response.write("<input type='button' value='Download Masterfile' class='button' onclick='exportmasterfile();' /><br />")
else
response.write("Masterfile not found. <br />")
end if
set fs=nothing
Run Code Online (Sandbox Code Playgroud)
javascript函数为空.
And*_*ech 21
实际上,如果你想要一种"更有效"(和更性感)的方式,请使用:
location.href = your_url;
Run Code Online (Sandbox Code Playgroud)
这样,您可以将编译器保存一段时间,location直到达到window对象的原型链.
Kab*_*lam 19
你不会相信这一点.找到了...
function exportmasterfile()
{ var url='../documenten/Master-File.xls';
window.open(url,'Download');
}
Run Code Online (Sandbox Code Playgroud)
对不起大家!
如果您的服务器配置为触发下载该mime类型的文件,那么就像这样简单:
window.location = your_url
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
67937 次 |
| 最近记录: |