晴明的博客园 GitHub      CodePen      CodeWars     

文章分类 -  JavaScript

上一页 1 ··· 7 8 9 10 11 12 下一页
摘要:ok( truthy [, message ] ) //truthy结果true则显示message信息 1 QUnit.test("ok test", function(assert) { 2 assert.ok(true, "true succeeds"); 3 assert.ok("non-e 阅读全文
posted @ 2016-02-23 16:48 晴明桑 阅读(196) 评论(0) 推荐(0)
摘要:#宝宝心里苦啊 1 function findMissingNumber(sequence) { 2 // if (typeof sequence != 'string') { 3 // return 0; 4 // } 5 // if (sequence.replace(/\s+/g, '').l 阅读全文
posted @ 2016-02-23 12:54 晴明桑 阅读(229) 评论(0) 推荐(0)
摘要:(number%1==0)可用于判断是不是整数,小数%1是小数 isNaN()检测 是否是 NaN,因为 NaN!=NaN += -= *= /= Number() 奇巧淫技:+数字 相当于Number(数字 ) parseInt() parseFloat() #parseInt()可用于进制转换, 阅读全文
posted @ 2016-02-22 00:46 晴明桑 阅读(272) 评论(0) 推荐(0)
摘要:# 工厂模式 缺点: 不能识别对象类型 阅读全文
posted @ 2016-02-21 17:21 晴明桑 阅读(151) 评论(0) 推荐(0)
摘要:# 1 <!DOCTYPE html> 2 <html> 3 4 <head> 5 <meta charset="UTF-8"> 6 <title></title> 7 </head> 8 9 <body> 10 <script> 11 /* 12 * 数据属性 13 */ 14 var perso 阅读全文
posted @ 2016-02-21 17:17 晴明桑 阅读(270) 评论(0) 推荐(0)
摘要:# 1 <!DOCTYPE html> 2 <html> 3 4 <head> 5 <meta charset="UTF-8"> 6 <title></title> 7 </head> 8 9 <body> 10 <script> 11 //原理。可能需要规定除了公共方法,或者明确变量名不冲突,其他 阅读全文
posted @ 2016-02-21 16:13 晴明桑 阅读(299) 评论(0) 推荐(0)
摘要:# 总结 : function x(){}称之为函数声明 var x = function(){} 称之为函数表达式,也就是匿名函数 (function(){})() 立即调用的函数表达式 (IIFE) function x(){}与var x = function(){}的区别在于var x = 阅读全文
posted @ 2016-02-21 11:50 晴明桑 阅读(163) 评论(0) 推荐(0)
摘要:# 阅读全文
posted @ 2016-02-21 00:34 晴明桑 阅读(191) 评论(0) 推荐(0)
摘要:#显示到指定时间的剩余时间 # 阅读全文
posted @ 2016-02-19 18:44 晴明桑 阅读(158) 评论(0) 推荐(0)
摘要:基本构造器 按照惯例,构造函数以大写字母开头 //构造函数本身可不需要return, //按照惯例的话,构造函数第一个字母大写, //可将实例标识为特定的类型 缺点:不便于继承。 实例化的多种方式 由多个实例化使用同一个方法,反复创建,引出的使用全局函数,然后又引出 使用原型的构造器 使用原型的构造 阅读全文
posted @ 2016-02-19 18:36 晴明桑 阅读(226) 评论(0) 推荐(0)
摘要:# Date.prototype.valueOf()与 Date.prototype.getTime() 功能相等 总结 new Date() 识别: ① Date.parse() 识别的日期格式 ② Date.UTC() 识别的日期格式 ③ Unix时间 Date.prototype.toTime 阅读全文
posted @ 2016-02-19 02:56 晴明桑 阅读(189) 评论(0) 推荐(0)
摘要:# # # #一般移动动画的实现 #数组分块 array chunking (yielding processes) #函数节流,防止连续重复操作 # 阅读全文
posted @ 2016-02-18 18:02 晴明桑 阅读(232) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Touch</title> <meta name="viewport" content="width=device-width, user-scalable=no"> </head 阅读全文
posted @ 2016-02-18 13:53 晴明桑 阅读(1970) 评论(0) 推荐(0)
摘要:console.log(document.body.scrollHeight); var a = document.body.scrollHeight; window.addEventListener("scroll", function(event) { var scrollTop = docum 阅读全文
posted @ 2016-02-18 11:05 晴明桑 阅读(6150) 评论(0) 推荐(1)
摘要:window.addEventListener('wheel', function(event) { //或mousewheel。但是他们都不兼容 firefox console.log(event.wheelDelta); //上 120,下 -120 }) window.addEventList 阅读全文
posted @ 2016-02-18 10:40 晴明桑 阅读(617) 评论(0) 推荐(1)
摘要:<html> <head> <meta charset="UTF-8"> <title>insertAdjacentHTML</title> </head> <body> <div id="paral" style="background:lavender;min-height:100px;bord 阅读全文
posted @ 2016-02-17 17:57 晴明桑 阅读(128) 评论(0) 推荐(0)
摘要://var arr = new Array(1,12,4,124.45,8,99998,456);var arr = [1,12,4,124.45,8,99998,456];var a = Math.max.apply(Math,arr);var b = Math.max.apply({},arr) 阅读全文
posted @ 2016-02-16 11:13 晴明桑 阅读(143) 评论(0) 推荐(0)
摘要:function getLocation(callback){ if(navigator.geolocation){ navigator.geolocation.getCurrentPosition( function(p){ callback(p.coords.latitude, p.coords 阅读全文
posted @ 2016-02-16 01:05 晴明桑 阅读(115) 评论(0) 推荐(0)
摘要:Date.prototype.Format = function(formatStr) { var str = formatStr; var Week = ['日', '一', '二', '三', '四', '五', '六']; str = str.replace(/yyyy|YYYY/, this 阅读全文
posted @ 2016-02-16 01:03 晴明桑 阅读(151) 评论(0) 推荐(0)
摘要:华为360*640??? 未测document.documentElement #实际高度为0 <body><div id="a" style="background:red;"></div> </body> #超过全屏 <body> <div id="a" style="background:re 阅读全文
posted @ 2016-02-04 16:32 晴明桑 阅读(167) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 下一页