随笔分类 -  前端

前端代码
摘要://ueditor有标签文本 function getContent() { var arr = []; arr.push(UE.getEditor('editor').getContent()); return arr.join(""); } ... 阅读全文
posted @ 2019-06-17 16:44 yvioo 阅读(2294) 评论(0) 推荐(0) 编辑
摘要:可能是应该返回内容带了标签,过滤下 这样就可以了 阅读全文
posted @ 2019-05-08 18:12 yvioo 阅读(770) 评论(0) 推荐(0) 编辑
摘要:通过判断浏览器的userAgent,用正则来判断是否是ios和Android客户端。代码如下: <script type="text/javascript"> var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 阅读全文
posted @ 2019-05-03 15:23 yvioo 阅读(2762) 评论(0) 推荐(0) 编辑
摘要:function isDate8(sDate) { if (!/^[0-9]{8}$/.test(sDate)) { return false; } var year, month, day; year = sDate.substring(0, 4); month = sDate.... 阅读全文
posted @ 2019-05-03 15:17 yvioo 阅读(2188) 评论(0) 推荐(0) 编辑
摘要:/* 验证手机号 */ function isPhoneNo(phone) { var pattern = /^1[3456789]\d{9}$/; return pattern.test(phone); } 只验证了手机长度和手机首位必须是1开头,第二位必须是3,4,5,6,7,8,9 ,正确返回 阅读全文
posted @ 2019-05-03 15:15 yvioo 阅读(326) 评论(0) 推荐(0) 编辑
摘要:正确返回true 错误返回false isIdCardNo.js function isIdCardNo(num) { var factorArr = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1); var par 阅读全文
posted @ 2019-05-03 15:14 yvioo 阅读(282) 评论(0) 推荐(0) 编辑
摘要:function jqchk(){ //jquery获取复选框值 var chk_value =[]; $('input[class="sel"]:checked').each(function(){ chk_value.push($(this).val()); }); if(chk_value.l 阅读全文
posted @ 2019-04-28 11:43 yvioo 阅读(10010) 评论(0) 推荐(0) 编辑
摘要:总选框: 子选框: /** * 全选 反选 */ $(".all").bind("click",function(){ $(".sel").prop("checked",$(this).prop("checked")); }) $(".s... 阅读全文
posted @ 2019-04-28 11:39 yvioo 阅读(264) 评论(0) 推荐(0) 编辑
摘要:var mo=function(e){ e.preventDefault() }; /***禁止滑动***/ function stop(){ document.body.style.overflow='hidden'; document.addEventListener("touchmove",mo,false);//禁止页面滑动 } /***取消滑动限制***/... 阅读全文
posted @ 2019-04-19 10:29 yvioo 阅读(619) 评论(0) 推荐(0) 编辑
摘要:注:样式需要自己修改 阅读全文
posted @ 2019-03-20 09:53 yvioo 阅读(386) 评论(0) 推荐(0) 编辑
摘要:<div> <input type="tel" id="mobile" name="mobile" placeholder="输入手机号码" /> <button onclick="getSms();return false" id="yzmMsg">获取验证码</button></div><div 阅读全文
posted @ 2019-03-14 12:01 yvioo 阅读(3645) 评论(0) 推荐(0) 编辑
摘要://判断class='required' 是否都必填 function required() { var flag = true; $(".required").each(function () { if ($(this).val() == '') { var posi = $(this).data('info'); ... 阅读全文
posted @ 2019-03-11 16:39 yvioo 阅读(907) 评论(0) 推荐(0) 编辑
摘要://输入和黏贴操作时触发 //小数点后两位 function num(obj) { obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符 obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字 obj.value = obj.value.... 阅读全文
posted @ 2019-03-11 16:31 yvioo 阅读(4883) 评论(0) 推荐(0) 编辑
摘要:2 var array = [0, 1, 2, 3, 4, 'age', 6, 7, 8, 9]; 3 var array2 = [0, 1, 'age', 6, 7, 8, 9]; 4 var arr3 = []; 5 for(key in array) { //用来遍历的数组使用两个数组长度比较长的,不然可能没有效果 6 var stra = array[key]... 阅读全文
posted @ 2019-03-11 14:57 yvioo 阅读(4228) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示