摘要: 输入:http://www.js-51.com/news/2012-5/GUANLIRUANJIANYAOBUYAOBAYIYONGXINGFANGZAIZHONGYAOWEIZHI.html?q=all&l=zh-cn#go1 href全部URl字符串(在浏览器中就是完整的地址栏)返回: http://www.js-51.com/news/2012-5/GUANLIRUANJIANYAOBUYAOBAYIYONGXINGFANGZAIZHONGYAOWEIZHI.html?q=all&l=zh-cn#go2 protocolURL 的协议部分返回:http:3 hostURL 阅读全文
posted @ 2012-05-16 23:19 陈锐达 阅读(6396) 评论(0) 推荐(0) 编辑
摘要: 一个简短的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 陈锐达 阅读(2382) 评论(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 陈锐达 阅读(2140) 评论(0) 推荐(0) 编辑
摘要: 变位词var words='uta,ust,ute,uva,vai,ure,urd,urf,urn,uro,urs,use,ush,ups,ura,ume,ule,udo,uds,ugh,tua,tub,tug,tue,tun,tup,tur,twa,twi,two,tye,tib,tic,tid,tho,tig,til,tin,tip,tis,toa,tod,tog,toi,tol,tom,to... 阅读全文
posted @ 2010-11-26 22:54 陈锐达 阅读(2675) 评论(0) 推荐(0) 编辑
摘要: 1.生成k个[0,n]区间内的随机数 No1. 缺点:不能确定循环次数,当n和k相当大的时候,速度慢!No2. 需要额外的方法来交换,不过运行次数为k. 阅读全文
posted @ 2010-11-10 21:55 陈锐达 阅读(216) 评论(0) 推荐(0) 编辑