摘要: String对象有3组转码与解码的方法(返回的都是该字符串的一个副本) 转码 解码 escape unescape encodeURI decodeURi encodeURIComponent decodeURIComponent 其中encodeURI与encodeURIComponent的区别在于:(来自51job的javascript encodeURI和encode... 阅读全文
posted @ 2013-08-30 14:03 独角xi 阅读(1053) 评论(0) 推荐(0) 编辑
摘要: location对象是Obejct的一个实例,包含以下 几个方法和属性 1window对象和Document对象的location属性是引用到Location对象 2.location对象的属性(都会进行转码) 属性 描述 hash 从”#”号开始的url host 主机名和当前url的端口号 hostname 当前url的主机名 href 完整的url pathname 当前... 阅读全文
posted @ 2013-08-30 11:57 独角xi 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 浏览器开发工具的秘密——转自涂鸦码农 阅读全文
posted @ 2013-08-30 09:32 独角xi 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 1.document.all是页面内所有元素的一个集合;2.经测试在chrome,safari,opera,ie中均返回一个HTMLALLCollection[xx]对象,在FF中返回是一个undefined; 返回的这个集合中第一个元素为html,包含所有的元素,第二个为head,第三个是head的子元素,当head中的子元素排列完毕后,才会去排列body中的元素;(从最外层,从头到尾的剥皮,遇到‘富有’的元素,先把它‘榨干’,再继续下一项,直到最底部的元素为止)(chrome v30.0.1599.10; safari v5.17(7534.57.2); opera v16.0.1196. 阅读全文
posted @ 2013-08-30 00:09 独角xi 阅读(409) 评论(0) 推荐(0) 编辑
摘要: 来自w3school的解释 定时器setInterval() 方法可按照指定的周期(以毫秒计)来调用函数或计算表达式。setInterval() 方法会不停地调用函数,直到 clearInterval() 被调用或窗口被关闭。由 setInterval() 返回的 ID 值可用作 clearInterval() 方法的参数。setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式... 阅读全文
posted @ 2013-08-29 12:10 独角xi 阅读(240) 评论(0) 推荐(0) 编辑
摘要: YUI原码YUI someYArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) { return Native.some.call(array, fn, thisObj);} : function (array, fn, thisObj) { for (var i = 0, len = array.length; i < len; ++i) { if (i in array && fn.call(thisObj, array[i], i, array)) { ... 阅读全文
posted @ 2013-08-29 10:11 独角xi 阅读(218) 评论(0) 推荐(0) 编辑
摘要: YUI原码YUI indexOfYArray.indexOf = Lang._isNative(Native.indexOf) ? function (array, value, from) { return Native.indexOf.call(array, value, from);} : function (array, value, from) { // http://es5.github.com/#x15.4.4.14 var len = array.length; from = +from || 0; from = (from > 0 || -1) ... 阅读全文
posted @ 2013-08-28 23:39 独角xi 阅读(206) 评论(0) 推荐(0) 编辑
摘要: hash就是把两个参数合并成一个类似hashMap结构的对象,用第一个数组的元素为key,第二个的为value,如果第二个参数未指定,则把对象的对应的值置为trueYUI原码YUI hashYArray.hash = function (keys, values) { var hash = {}, vlen = (values && values.length) || 0, i, len; for (i = 0, len = keys.length; i i && i in values ? values[i] : true; } ... 阅读全文
posted @ 2013-08-28 22:52 独角xi 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 1. yui-each原码:遍历YArray.each = YArray.forEach = Lang._isNative(Native.forEach) ? function (array, fn, thisObj) { Native.forEach.call(array || [], fn, thisObj || Y); return Y;} : function (array, fn, thisObj) { for (var i = 0, len = (array && array.length) || 0; i < len; ++i) { if (i i... 阅读全文
posted @ 2013-08-28 22:28 独角xi 阅读(390) 评论(0) 推荐(0) 编辑
摘要: YUI.Array.dedupe函数,如果传参为有length属性,返回一个去除掉重复项('1’ 与1 | true 与'true’认为相等)的参数数组副本,如果传参的length为undefined,那么返回一个空数组[],如果传参没length属性,抛出一个类型错误数组去重YArray.dedupe = Lang._isNative(Object.create) ? function (array) { var hash = Object.create(null), results = [], i, item, len; for (i = 0,... 阅读全文
posted @ 2013-08-28 20:07 独角xi 阅读(343) 评论(0) 推荐(0) 编辑