关于indexof和substring经常记不住的点
摘要:indexof 找到的字符位置是 字符串从0位开始算起的。 lastIndexOf也一样,http://localhost:8080/aaa,的lastIndexOf("/")是21位。 substring(0,a)截取的是,从0位开始算起的,直到第(a-1)位字符,不包含a位字符,例如: var
阅读全文
拿到iframe页面里面的变量及元素的方法
摘要:先严重差评一下,用这种方法window.parent.document.frames['layui-layer-iframe1']不行!而且frames方法存在浏览器不兼容问题(貌似火狐不行) 页面document明明就拿到的iframe元素 接下来考虑用jquery来拿,亲测可行,但是!jquer
阅读全文
datatables 多一列报错Cannot read property 'sWidth' of undefined(…)/少一列报错Cannot read property 'style' of undefined(…)
摘要:datatables 多一列报错Cannot read property 'sWidth' of undefined(…)/少一列报错Cannot read property 'style' of undefined(…) 检查列数量是否对应datatable option列配置数,多一列少一列都报
阅读全文
后台返回json字符串 页面js报错 Uncaught SyntaxError: Unexpected identifier
摘要:后台json字符串是 [{"name": "报销申请", "id": "start"}, {"name": "部门经理审批", "id": "departAudit"}, {"name": "总经理审批", "id": "bossAudit"}, {"name": "财务经理审批", "id": &
阅读全文
js数组求和
摘要:callback : 函数执行在数组中每个值 initialValue : 对象作为第一个参数回调的第一次调用使用 reduce()和reduceRight()方法 reduce()和reduceRight()方法可以接受一个回调函数callbackfn作为累加器(accumulator),数组中的
阅读全文
easyUI 比较时间大小
摘要:// function toDate(str){ // var sd=str.split("-"); // return new Date(sd[0],sd[1],sd[2]); // } // var d1=toDate("2001-2-2 "); 结果与new Date(startTime.re
阅读全文
js截取字符串
摘要:var activityId = "${activityId}"; var processKey = activityId.substr(0,activityId.indexOf(":")); var activityKey = activityId.substr(activityId.indexO
阅读全文
js父窗口opener与parent
摘要:parent表示父窗口,比如一个A页面利用iframe或frame调用B页面,那么A页面所在窗口就是B页面的parent。在JS 中,window.opener只是对弹出窗口的母窗口的一个引用。比如:a.html中,通过点击按钮等方式window.open出一个新的窗口 b.html。那么在b.ht
阅读全文
js定时器window.setTimeout和setInterval
摘要://调用iframe里的setContent()方法 setTimeout 和setInterval的功能都是经过某一个时间段后发生某件指定的事件或者方法。 如window.setTimeout(“sleep()”,5000);指的是在5000ms后去执行sleep方法,setTimeout也可以直
阅读全文
js回调函数callback()
摘要:<a id="btnSave" href="javascript:void(0)" class="easyui-linkbutton" data-options="disabled:false" onclick="backsave(closedialog)">保存</a> <!--WizRtf2Ht
阅读全文
js相差天数计算
摘要:dueDate = new Date(row.dueDate.replace(/-/g,'/')); if(dueDate<systemDate){ var time = systemDate.getTime() - dueDate.getTime(); var days = parseInt(ti
阅读全文
jQuery 序列化表单 serialize() serializeArray()
摘要:1.serialize()方法 格式:var data = $("form").serialize(); 功能:将表单内容序列化成一个字符串。 这样在ajax提交表单数据时,就不用一一列举出每一个参数。只需将data参数设置为 $("form").serialize() 即可。 2.serializ
阅读全文
bootstrap-datetimepicker 时间表箭头不能显示
摘要:我使用的是bootstrap-datetimepicker+bootstrap v3,但这个插件使用的时候,并没有和V3相匹配,仍然调用的是bootstrap V2的图标,代码是: <i class="icon-arrow-right"></i> 截图: 但我在看这个项目的实例代码的时候,提供有V2
阅读全文
radio的change事件
摘要:radio的change事件 <scripttype="text/javascript"> $(document).ready(function(){ $(".radioItem").change(function(){ var $selectedvalue = $("input[name='rl$
阅读全文
datatables定义列宽自适应方法
摘要:不同的分辨率以及浏览器自适应,列表不出现滚动条,表格内容自动换行。 ' style="table-layout: fixed;" 这样操作之后,table是宽度固定了,但是里面的文章如果很长,文字还是会跑出来 解决办法: 在 td 里面 加上 style="word-wrap:break-word;
阅读全文
checkbox复选框
摘要:改变checkbox状态 所有的jquery版本都可以这样赋值:// $("#cb1").attr("checked","checked");// $("#cb1").attr("checked",true); 是否被选中事件为change事件 是否被选中事件为change事件 也可以写为: 来自为
阅读全文
datatables常见报错
摘要:Uncaught TypeError: Cannot read property 'style' of undefined 分析:列表配置 columnDefs 列数不匹配 来自为知笔记(Wiz)
阅读全文