首页 技术 正文
技术 2022年11月18日
0 收藏 780 点赞 3,174 浏览 1573 个字

由于业务需求要下载文件的功能:

  <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
</head>
<body>
<input type="button" id="clickme" value="clickme" />
</body>
<script type="text/javascript">
function postExcelFile(params, url) { //params是post请求需要的参数,url是请求url地址
var form = document.createElement("form");
form.style.display = 'none';
form.action = url;
form.method = "post";
document.body.appendChild(form); for(var key in params){
var input = document.createElement("input");
input.type = "hidden";
input.name = key;
input.value = params[key];
form.appendChild(input);
} form.submit();
form.remove();
}
//点击导出按钮导出excel表格
clickme.onclick = function() {
var params = {};
//params.queryDateEnd='20180709';
//params.queryDate='20180709';
//params.productId=0;
// params.chnMerchant='咪咕视讯,咪咕+,内部导流';
//params.chnAttr='咪咕视讯自有渠道,咪咕互娱';
//params.chnID='101700010000009,308500040040028,101800000030119,10290001916,101400030060133';
//postExcelFile(params, "http://localhost:8082/kpi/chnOperate/export"); params.queryDate='2018-08-16';
params.productId=0;
params.channel1Id='12924,12925,12926';
params.channel2Id='332584,12927,333950,314216';
//params.channel3Id='332585,12938,333951';
//params.channel4Id='335273,332081,336699';
//params.chnID='201600010000758,202400000000006';
postExcelFile(params, "http://wxs.ngrok.xiaomiqiu.cn/kpi/chnOperate/realTime/daily/list/export");
} </script>
</html>
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,983
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,500
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,344
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,127
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,761
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,838