前端js 常用笔记

var rows = dataGridSelMore(datagrid);
//遍历数组
$.each(rows,function (i,obj) {
    //遍历对象
    $.each(obj,function (name,value) {
        console.log(name)
        console.log(value)
    })
})

//对象获取,通过outerHTML 输出
var input = $('<input type="text" />');
      input.attr('name', this.field)
          .attr('id', this.field + '_' + row.id)
          .attr('class', 'easyui-numberbox')
       .attr('value', row.weight || '0.0')
       //.attr('readonly', true)
          .attr('data-options', this['formatterOptions']);
  return input.prop('outerHTML');
//Jquery 简单的进度条
//打开
 $.messager.progress({title: '系统提示',msg: '正在保存,请稍候……',text:''})
//关闭
 $.messager.progress('close');
select 表标签 二级联动 

$('#city').on('change', function(){
   var op = $(this);
   var id = op.find('option:selected').attr('alt');
   if ('' != id) {
      if (!ops2[id]) {
        //异步获取二级联动的数据
         $.getJSON('questionCategory/listRegionForOptions.do?id=' + id, function(result) {
            resetOptions($('#region'), result);
         });
      } else {
         resetOptions($('#region'), ops1[id]);
      }
   }
});

//移除,再添加
function resetOptions(jobj, options) {
    //排序第一个
   jobj.find('option').not(jobj.find('option:eq(0)')).remove();
   $.each(options, function(i) {
      console.log(this);
      jobj.append($('<option value="' + this.name + '" alt="' + this.id + '" >' + this.name + '</options>'));
   });
}
将 1 转为 0001 (整形 转 字符串),用于生成流水号

String.format("-%04d",(Integer)arrivalNum+1);
jsp 到出excel 图片大小设置 不能加 px


<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName()+":" + request.getServerPort() + path + "/";

    String fileName = (String) request.getAttribute("fileName");
    fileName=new String(fileName.getBytes("UTF-8"), "ISO8859-1" );
    response.setContentType("application/vnd.ms-excel;charset=UTF-8");
    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
%>

<%--插入图片--%>
 <img height="30" width="120" src="userpic/5e6cb1542a67465ca57eaf82e5eb44f5.jpg"/><br>

//高度自适应
<div style="width=300px;word-break:break-all; word-wrap:break-word;white-space:pre-wrap;">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值