2017年11月27日
摘要: const RetainDecimal = (num, count, type) => { // num -> 需要保留的小数, count -> 需要保留的位数, type -> 保留的类型, eg: 'floor': 向下取整, 默认是四舍五入 const ratio = 10 ** count 阅读全文
posted @ 2017-11-27 19:19 weimo10235 阅读(915) 评论(0) 推荐(0)
2017年10月11日
摘要: const diffTextCountFontSize = (strText, boxWidth) => { let textLength = strText.length; let l = 0; for (const i in strText) { if (strText.charCodeAt(i 阅读全文
posted @ 2017-10-11 18:41 weimo10235 阅读(413) 评论(0) 推荐(0)
2017年9月21日
摘要: const getDaysInMonth = (month, year) => { // 得到不同月份的天数 switch (month) { default: break; case 4: case 6: case 9: case 11: return 30; case 2: return ((( 阅读全文
posted @ 2017-09-21 18:50 weimo10235 阅读(124) 评论(0) 推荐(0)
摘要: const isEmptyObject = (curObj) => { for (const i in curObj) { return false; } return true;}; 阅读全文
posted @ 2017-09-21 18:49 weimo10235 阅读(90) 评论(0) 推荐(0)
2017年7月18日
摘要: handleURL(url) { const urlARG = location.search.slice(1).split('&'); const urlVAL = urlARG.find(n => n.startsWith(`${url}=`)).split('=')[1]; return ur 阅读全文
posted @ 2017-07-18 16:44 weimo10235 阅读(113) 评论(0) 推荐(0)
2017年3月3日
摘要: //Ajax四部曲 util.xhrGo = function(req,route,judge,callback,isnull){ var xhr = this.createXHR();//创建请求 xhr.open(req,route,judge);//open这个url xhr.onreadys 阅读全文
posted @ 2017-03-03 11:36 weimo10235 阅读(486) 评论(0) 推荐(0)
2017年3月2日
摘要: //文字闪烁(ps:obj上不能设置初始颜色,但可以在其父级为其设置初始颜色) util.textFlash = function(obj,className,times){ var i=0,t=false,o=obj.attr("class")+"",c="",times=times||2; // 阅读全文
posted @ 2017-03-02 23:19 weimo10235 阅读(247) 评论(0) 推荐(0)
摘要: //验证码 var code; //testCode是验证码字符块,此事件加在’换一换‘链接以及body的onload上 util.createCode = function(testCode,len) { code = ""; var codeLength = len; //验证码的长度 var 阅读全文
posted @ 2017-03-02 23:15 weimo10235 阅读(191) 评论(0) 推荐(0)