随笔分类 - javaScript
摘要:匹配IP function isIP1(strIP) { if (strIP == ""){return false}; var strRegex= /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[09][0-9]|[1-9][0-9]|[0-9]|\*)$...
阅读全文
摘要:/*cookie start*/ var Cookie=new function(){ //添加cookie this.add=function(name,value,hours){ var life=new Date().getTime(); life+=hours*1000*60; var cookieStr=name+"="+...
阅读全文
摘要:function Map() { var struct = function(key, value) { this.key = key; this.value = value; } var put = function(key, value){ for (var i = 0; i < this.ar
阅读全文
摘要:/** * 此JS文件是格式化JS中日期时间的工具类,其中包含了传入日期对象Date,格式化成想要的格式,<br> * 或者传入字符串格式的时间个,次字符串日期对应的格式可以转换为相应的日期对象,<br> * 可以计算两个日期之间的差值 * * y: 表示年 * M:表示一年中的月份 1~12 *
阅读全文
摘要:document.onmousedown = function(e){ var ev = document.all ? window.event : e; var _con = $("#cicon"); // 设置目标区域 if(!_con.is(e.target) && _con.has(e.ta
阅读全文
摘要:$(".checkall").change(function(){ if($(this).is(":checked")){ $(".checkchild").prop('checked', this.checked); }else{ $(".checkchild").prop('checked',
阅读全文
摘要:引用 ;http://www.jb51.net/article/87189.htm 一、时间组件 bootstrap风格的时间组件非常多,你可以在github上面随便搜索“datepicker”关键字,可以找到很多的时间组件。博主原来也用过其中的两个,发现都会有一些大大小小的问题。经过一番筛选,找到
阅读全文
摘要:/判断输入内容是否为空 function IsNull(){ var str = document.getElementById('str').value.trim(); if(str.length==0){ alert('对不起,文本框不能为空或者为空格!');//请将“文本框”改成你需要验证的属
阅读全文
摘要://获取表单参数 var DataDeal = { formToJson: function (id) { var data=$(id).serialize();//获取值 data = decodeURIComponent(data,true);//防止中文乱码 data=data.replace
阅读全文
摘要:<input type="file" id="testUpload"> <img src="" id="img" alt=""> <script> // 前端只需要给input file绑定这个change事件即可(下面两个方法不需要修改)获取到图片 $('#testUpload').change(
阅读全文
摘要:<input id="file" type="file"> <img id="img" style="max-height: 300px;"> <textarea id="textarea" style="width: 100%;height: 300px;"></textarea> <script
阅读全文