一周乱弹(1,摸态框增加纵向滚动条2,jQuery 鼠标点击事件3,通过ajax实现批量导出。4,windows查询占用某个端口号程序并杀死其进程)
2016-08-21 21:04
811 查看
1,摸态框增加纵向滚动条
在摸态框的body标签上增加:style="height: 600px;overflow: auto"
2 jQuery 鼠标点击事件。
$(function(){
$('a').mousedown(function(e){
alert(e.which) // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键
return false;//阻止链接跳转
})
})
如
$('#downwps2010').mousedown(function(e){
if(3 == e.which){
alert('这 是右键单击事件');
}else if(1 == e.which){
alert('这 是左键单击事件');
}
})
3,通过ajax实现批量导出。
说明:ajax 其实只是一个javascript中的一个组建 XmlHttpRequest, 他的作用是数据交互, 返回数据是组件内部处理的, 下载是需要浏览器识别http头的,所以如果想实现导出功能,后台要设置response响应头等相关信息
后台代码举例:
/* HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("application/msword; charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename="+wname);
response.setCharacterEncoding("utf-8");
OutputStream outfa = response.getOutputStream();*/
@RequestMapping(value = "/approve-export/{formId}",method = RequestMethod.GET)
@ResponseBody
public void exportApprove(@PathVariable("formId")String formId,HttpServletRequest request,HttpServletResponse response)throws Exception{
HWPFDocument hwpf = this.getBaseAllService().getSchoolBusinessApproveService().exportApproveInfo(formId, request);
response.addHeader("Content-Disposition", "attachment;filename=" + FileNameEncoderUtil.encode(request,"来校经商申请表.doc"));
response.setContentType("application/vnd.ms-excel");
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
hwpf.write(toClient);
toClient.flush();
toClient.close();
} 其中_blank必须加上,如果写成_self,虽然是循环打开但是后一个会把前一个覆盖,所以最终只会得到一个。
4,windows查询占用某个端口号程序并杀死其进程。
查询占用某个端口号
netstat -aon | findstr "1688"
查看其程序名称
tasklist | findstr "1688"
结束进程
taskkill /pid 1688 /F
在摸态框的body标签上增加:style="height: 600px;overflow: auto"
2 jQuery 鼠标点击事件。
$(function(){
$('a').mousedown(function(e){
alert(e.which) // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键
return false;//阻止链接跳转
})
})
如
$('#downwps2010').mousedown(function(e){
if(3 == e.which){
alert('这 是右键单击事件');
}else if(1 == e.which){
alert('这 是左键单击事件');
}
})
js代码: function exportComment(classesId) { //得到班级学生id var url1 = "train/review-stu-find/" + classesId; $.get(url1, function (resp) { var students = resp.data; //ajax动态导出 for(index in students) { var url2 = "train/classes-situation-export/"+classesId+"/"+students[index].id+"?"+Math.random();//这个为我的导出时href的连接, window.open(url2,"_blank"); } }, "json"); }
3,通过ajax实现批量导出。
说明:ajax 其实只是一个javascript中的一个组建 XmlHttpRequest, 他的作用是数据交互, 返回数据是组件内部处理的, 下载是需要浏览器识别http头的,所以如果想实现导出功能,后台要设置response响应头等相关信息
后台代码举例:
/* HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("application/msword; charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename="+wname);
response.setCharacterEncoding("utf-8");
OutputStream outfa = response.getOutputStream();*/
@RequestMapping(value = "/approve-export/{formId}",method = RequestMethod.GET)
@ResponseBody
public void exportApprove(@PathVariable("formId")String formId,HttpServletRequest request,HttpServletResponse response)throws Exception{
HWPFDocument hwpf = this.getBaseAllService().getSchoolBusinessApproveService().exportApproveInfo(formId, request);
response.addHeader("Content-Disposition", "attachment;filename=" + FileNameEncoderUtil.encode(request,"来校经商申请表.doc"));
response.setContentType("application/vnd.ms-excel");
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
hwpf.write(toClient);
toClient.flush();
toClient.close();
} 其中_blank必须加上,如果写成_self,虽然是循环打开但是后一个会把前一个覆盖,所以最终只会得到一个。
4,windows查询占用某个端口号程序并杀死其进程。
查询占用某个端口号
netstat -aon | findstr "1688"
查看其程序名称
tasklist | findstr "1688"
结束进程
taskkill /pid 1688 /F
相关文章推荐
- 通过Ajax+jquery实现的动态增加一组查询条件的实例
- Linux下通过端口号查询占用的进程,并知道其所在的位置
- vbs实现windows通过文本导入批量增加用户
- 一周乱弹(1,eclipse 远程调试tomcat。2,常量类的作用。3,通过花生壳实现远程连接 端口:3389),4oracle查询日期5,bootstrap文本样式6,6 js四舍五入
- 通过监听Windows消息实现控件的键盘和鼠标事件路由
- jQuery实现鼠标滑过点击事件音效试听
- windows应用开发由浅入深(三)有关鼠标事件--设置鼠标点击测试值实现非标题栏拖动窗口
- 使用jQuery 模拟鼠标点击a标签事件 实现定位
- Windows - 杀死占用某个端口号的进程
- 在windows的命令行中快速查询占用端口的进程并且快速杀死这个进程
- jQuery实现鼠标滑过点击事件音效试听
- tomcat端口被占用-----windows下如何查询某个端口被哪个进程占用以及如何杀死进程
- HTML--如何实现通过鼠标事件拖动页面图像(代码)
- HTML--如何实现通过鼠标事件拖动页面图像(代码)
- 通过SmartInvoke运用java与flex轻松构建cs程序(捕获鼠标键盘事件)
- 通过事件实现简单的进程内业务实体监控
- 如何查询端口号被哪个程序占用?
- 通过 Mutex/Semaphore 实现程序进程实例的控制
- [jQuery教程]jquery基础教程二(鼠标点击事件)
- jquery实现的元素的left增加N像素 鼠标移开会慢慢的移动到原来的位置