摘要: var cyn = function(){ console.log("我是延时输出的函数")}setInterval(cyn,1000) 阅读全文
posted @ 2015-11-10 17:34 Cynthia娆墨旧染 阅读(153) 评论(0) 推荐(0) 编辑
摘要: var cyn = function(){ console.log("我是延时输出的函数")}setTimeout(cyn,5000) 阅读全文
posted @ 2015-11-10 17:34 Cynthia娆墨旧染 阅读(107) 评论(0) 推荐(0) 编辑
摘要: var scareMe = function(){ console.log("cynthia") scareMe = function(){ console.log("wuqian") }}scareMe() //cynthiascareMe() //wuqian//... 阅读全文
posted @ 2015-11-10 17:34 Cynthia娆墨旧染 阅读(116) 评论(0) 推荐(0) 编辑
摘要: //手机号验证var regMobile=/^1[3,5,8]\d{9}$/; //固定电话var regPhone=/^(^0\d{2}-?\d{8}$)|(^0\d{3}-?\d{7}$)|(^\(0\d{2}\)-?\d{8}$)|(^\(0\d{3}\)-?\d{7}$)$/; /* * 用... 阅读全文
posted @ 2015-11-10 17:33 Cynthia娆墨旧染 阅读(194) 评论(0) 推荐(0) 编辑
摘要: var cyn = function(){ console.log("one") return function(){ console.log("two") }}var test = cyn() //不能直接执行cyn()test() 阅读全文
posted @ 2015-11-10 17:33 Cynthia娆墨旧染 阅读(122) 评论(0) 推荐(0) 编辑
摘要: // 原型式继承// 其基本思路是借助原型可以基于已有的对象创建新的对象function object(o){ function F(){} F.prototype = o; return new F();}var person = { name: "Tom", friends: ["Jack... 阅读全文
posted @ 2015-11-10 17:32 Cynthia娆墨旧染 阅读(148) 评论(0) 推荐(0) 编辑
摘要: // 原型链// 其基本思路是利用原型让一个引用类型继承另一个引用类型的属性和方法function Person(){ this.name = "Person";}Person.prototype.getName = function(){ return this.name;}funct... 阅读全文
posted @ 2015-11-10 17:32 Cynthia娆墨旧染 阅读(200) 评论(0) 推荐(0) 编辑
摘要: // 1.任意参数的加法运算 function add(){ var sum = 0 for(var i=0;i<arguments.length;i++){ if(!isNaN(arguments[i])){ ... 阅读全文
posted @ 2015-11-10 17:32 Cynthia娆墨旧染 阅读(213) 评论(0) 推荐(0) 编辑
摘要: // 借用构造函数// 其基本思路是在子类型构造函数的内部调用父类型的构造函数function Person(name){ this.name = name; this.friends = ["Jack","John","Kim"];}function SuperPerson(name,sex)... 阅读全文
posted @ 2015-11-10 17:31 Cynthia娆墨旧染 阅读(153) 评论(0) 推荐(0) 编辑
摘要: // 寄生式继承// 其基本思路是类似创建对象时的工厂模式,将继承过程封装在一个函数里,然后返回一个对象function createObject(o){ var clone = Object.create(o); clone.sayHi = function(){ console.log(... 阅读全文
posted @ 2015-11-10 17:31 Cynthia娆墨旧染 阅读(126) 评论(0) 推荐(0) 编辑
摘要: // 组合继承// 其基本思路是使用原型链实现对原型属性和方法的继承,而通过借用构造函数来实现对实例属性的继承function Person(name){ this.name = name; this.friends = ["Jack","John","Kim"];}Person.prototy... 阅读全文
posted @ 2015-11-10 17:30 Cynthia娆墨旧染 阅读(210) 评论(0) 推荐(0) 编辑
摘要: // 寄生组合式继承// 其基本思路是通过借用构造函数来继承属性,通过原型链的混成形式来继承方法,就是为了不必为了子类型的原型去调用父类型的构造函数function inheritPrototype(superPerson,person){ var prototype=Object.create(... 阅读全文
posted @ 2015-11-10 17:30 Cynthia娆墨旧染 阅读(125) 评论(0) 推荐(0) 编辑
摘要: ( ) ( ( ) ) ( ( ( ) ) )########################## ############... 阅读全文
posted @ 2015-11-10 17:29 Cynthia娆墨旧染 阅读(222) 评论(0) 推荐(0) 编辑
摘要: // 可视宽高var ch = document.documentElement.clientHeightvar cw = document.documentElement.clientWidth// 内容高度var sh = document.documentElement.scrollHeigh... 阅读全文
posted @ 2015-11-10 17:29 Cynthia娆墨旧染 阅读(216) 评论(0) 推荐(0) 编辑
摘要: (function(){ var days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] var today = new Date() var msg = "Today is" + days[today.getDay()] + ',' ... 阅读全文
posted @ 2015-11-10 17:29 Cynthia娆墨旧染 阅读(166) 评论(0) 推荐(0) 编辑
摘要: function writeCode(callback){ console.log("i am waiting....") callback(); console.log("i am ready")}function prepare(){ console.log("i am preparing...... 阅读全文
posted @ 2015-11-10 17:28 Cynthia娆墨旧染 阅读(141) 评论(0) 推荐(0) 编辑
摘要: // “最后加” concat 连接两个或更多的数组,并返回结果。 var a = ['a','b','c']; var b = ['x','y','z']; var c = a.concat(b,true); // alert(c) //c变成 a,b,c,x,y,z//... 阅读全文
posted @ 2015-11-10 17:27 Cynthia娆墨旧染 阅读(227) 评论(0) 推荐(0) 编辑
摘要: // 异步加载js(function(){ var _asyn_js_data = ['index.js','index1.js','index2.js','index3.js'] for(var i=0;i<_asyn_js_data.length;i++){ var s... 阅读全文
posted @ 2015-11-10 17:27 Cynthia娆墨旧染 阅读(217) 评论(0) 推荐(0) 编辑
摘要:  举个例子 : 点击ul下面每个li的时候 背景成绿色   阅读全文
posted @ 2015-11-10 17:26 Cynthia娆墨旧染 阅读(173) 评论(0) 推荐(0) 编辑
摘要: <meta name="wap-font-scale" content="no"> 阅读全文
posted @ 2015-11-10 17:25 Cynthia娆墨旧染 阅读(234) 评论(0) 推荐(0) 编辑