摘要: var $ = function (id) {return "string" == typeof id ? document.getElementById(id) : id;};var Each = function(list, fun){ for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); }}; 阅读全文
posted @ 2012-08-15 16:31 李荣飞 阅读(150) 评论(0) 推荐(0) 编辑
摘要: <object data="music.mp3" type="application/x-mplayer2" width="0" height="0"> <param name="src" value="music.mp3"> <param name="autostart" value="1"> <param name="playcount" value="infi 阅读全文
posted @ 2012-08-15 16:15 李荣飞 阅读(1430) 评论(0) 推荐(0) 编辑
摘要: var idSeed = 0, ua = navigator.userAgent.toLowerCase(), check = function(r){ return r.test(ua); }, isStrict = document.compatMode == "CSS1Compat", isOpera = check(/opera/), isChrome = check(/chrome/), isWebKit = check(/webkit/), ... 阅读全文
posted @ 2012-08-15 15:35 李荣飞 阅读(271) 评论(0) 推荐(0) 编辑
摘要: jquery的实现方法function sibling(elem){ var r=[]; var n=elem.parentNode.firstChild; for(;n;n=n.nextSibling){ if(n.nodeType==1&&n!=elem){ r.push(n); } } return r; }一般方法function sibling(elem){ var r=[]; var childs=elem.parentN... 阅读全文
posted @ 2012-08-15 10:40 李荣飞 阅读(796) 评论(0) 推荐(0) 编辑
摘要: <script type="text/javascript">window.onload=function(){ var arr=[1,2,34,4,5]; Array.prototype.map = function(func,argu) { for(var i=0;i<this.length;i++){ func.apply(this[i],argu); } }; arr.map(function(){ alert(this); });}</script> 阅读全文
posted @ 2012-08-15 10:17 李荣飞 阅读(3034) 评论(0) 推荐(0) 编辑