04 2011 档案

摘要:一个简短的JavaScript特效。 1 var flyword = function(elem, txt, time){ 2 var _elem = document.getElementById(elem), 3 _timer = null, 4 _index = 0, 5 _array = []; 6 for(var i=0,len=txt.length;i<len;i++){ 7 var span = document.createElement("span"); 8 span.innerHTML=txt[i]; 9 _elem.appendChild 阅读全文
posted @ 2011-04-26 18:05 陈锐达 阅读(2388) 评论(0) 推荐(0) 编辑
摘要:这篇日志是读书笔记,来自JavaScript:The Good Parts 中的第八章。 Array array.concat(item...) concat方法返回一个新数组,包含array的浅复制并把一个或多个item附加到最后,如果参数是一个数组,那么它的每一个元素都会被分别添加。 var r = [0,1].concat([2,3],4);//r=[0,1,2,3,4]; array.j... 阅读全文
posted @ 2011-04-25 23:11 陈锐达 阅读(533) 评论(0) 推荐(1) 编辑
摘要:调用一个函数将会挂起当前函数的执行,并传递控制权与参数给新的函数。 除了声明的参数,每个函数会接收到两个新的附加参数:this和arguments。 this是个很重要的参数,并且它的值是由调用模式决定的。 以下是JavaScript中很重要的4个调用模式: a. 方法调用模式the method invocation pattern b. 函数调用模式the function invocation pattern c. 构造器调用模式the constructor invocation pattern d. Apply调用模式the apply invocation pattern  阅读全文
posted @ 2011-04-19 10:39 陈锐达 阅读(2141) 评论(0) 推荐(0) 编辑