一周乱弹(1,摸态框增加纵向滚动条2,jQuery 鼠标点击事件3,通过ajax实现批量导出。4,windows查询占用某个端口号程序并杀死其进程)

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('这 是左键单击事件'); 
				
					  } 
				})	
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 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值