11 2013 档案

摘要:1 x=function(){}2 x.a={}; //函数有属性????3 console.log(typeof x); //function4 console.log(typeof x.a); //object函数实际上是一个对象,每个函数都是Function类型的实例,而且都与其他引用类型一样具有属性和方法。 1 function sayName(name){ 2 alert(name); 3 } 4 function sum(num1,num2){ 5 return num1+num2; 6 } 7 function sayHi(){ 8 ale... 阅读全文
posted @ 2013-11-29 16:59 Western Journey 阅读(122) 评论(0) 推荐(0)
摘要:注:原文出自《JavaScript 中的一些坑(一)》http://roshanca.com/traps-in-javascript-part-I/ ,方便以后查找,所以就收藏了。---------------------------------------------------------------------------------------------------------------------------------------------------------由于 JavaScript “弱语言”的性质,使得其在使用过程中异常的宽松灵活,但也极为容易“掉进陷阱”。这些陷阱 阅读全文
posted @ 2013-11-27 14:34 Western Journey 阅读(254) 评论(0) 推荐(0)
摘要:[转载]1.this和event.target的区别: js中事件是会冒泡的,所以this是可以变化的,但event.target不会变化,它永远是直接接受事件的目标DOM元素;2.this和event.target都是dom对象,如果要使用jquey中的方法可以将他们转换为jquery对象:$(t... 阅读全文
posted @ 2013-11-27 14:14 Western Journey 阅读(409) 评论(0) 推荐(0)
摘要:$(selector).load(URL,data,callback);下面代码即为加载外部文件的a()函数 1 2 3 4 5 bind函数 6 7 8 16 17 18 19 20 阅读全文
posted @ 2013-11-27 11:45 Western Journey 阅读(249) 评论(0) 推荐(0)
摘要:window.screen.availWidth 返回当前屏幕宽度(空白空间) window.screen.availHeight 返回当前屏幕高度(空白空间) (1160像素,少了40像素???)window.screen.width 返回当前屏幕宽度(分辨率值) $(window).width()为浏览器窗口的宽度window.screen.height 返回当前屏幕高度(分辨率值) window.document.body.offsetWidth; 返回当前网页宽度 (网页的宽度为1904,少了16像素????)window.document.body.offsetHeight; 返回当 阅读全文
posted @ 2013-11-27 09:33 Western Journey 阅读(496) 评论(0) 推荐(0)
摘要:stop(stopAll,goToEnd)参数描述stopAll可选。规定是否停止被选元素的所有加入队列的动画。goToEnd可选。规定是否允许完成当前的动画。该参数只能在设置了 stopAll 参数时使用。stop(1,1) true 表示停止队列,true表示跳到当前动画的最终效果。默认为false; 阅读全文
posted @ 2013-11-26 17:38 Western Journey 阅读(221) 评论(0) 推荐(0)
摘要:1 2 3 4 5 return 6 18 19 20 21 1 阅读全文
posted @ 2013-11-25 14:18 Western Journey 阅读(176) 评论(0) 推荐(0)
摘要:1 2 3 4 5 改变作用域 6 16 17 18 19 通过apply或者call改变作用域,三者的结果是一样的,都会输出xxxx 阅读全文
posted @ 2013-11-25 11:10 Western Journey 阅读(322) 评论(0) 推荐(0)