2009年3月4日
摘要: // ==++== // // // Copyright (c) 2002 Microsoft Corporation. All rights reserved. // // The use and distribution terms for this software are contained in the file // named license.txt,... 阅读全文
posted @ 2009-03-04 20:11 hcmfys_lover 阅读(480) 评论(0) 推荐(0) 编辑
摘要: this是什么?? 为了建立一个scope chain, 每个JavaScript的代码执行上下文都提供了this关键字。In its most common usage, this serves as an identity function, providing our neighborhoods a way of referring to themselves. We can’t alway... 阅读全文
posted @ 2009-03-04 16:23 hcmfys_lover 阅读(199) 评论(0) 推荐(0) 编辑
摘要: document.getElementById("btn").onclick = method1; document.getElementById("btn").onclick = method2; document.getElementById("btn").onclick = method3; 如果这样写,那么将会只有medhot3被执行 写成这样: var btn1Obj = docu... 阅读全文
posted @ 2009-03-04 16:21 hcmfys_lover 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 一、实现类的公有成员: 1) 定义的成员属性和方法能够被任何实例访问,对任何的实例都是公开的,成为公有成员。在javascript中,一般的属性和方法的定义都是公有的,请看下面的例子:function class1(){ this.prop=1; this.showProp(); } //创建一个类的实例 var obj1=new class1(); class1.prototype... 阅读全文
posted @ 2009-03-04 16:20 hcmfys_lover 阅读(339) 评论(0) 推荐(0) 编辑
摘要: call 方法 请参阅 应用于:Function 对象 要求 版本 5.5 调用一个对象的一个方法,以另一个对象替换当前对象。 call([thisObj[,arg1[, arg2[, [,.argN]]]]]) 参数 thisObj 可选项。将被用作当前对象的对象。 arg1, arg2, , argN 可选项。将被传递方法参数序列。 说明 call 方法可以用来代替另一个对象调用一个... 阅读全文
posted @ 2009-03-04 16:17 hcmfys_lover 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 在面向对象编程语言中,对于this关键字我们是非常熟悉的。比如C++、C#和Java等都提供了这个关键字,虽然在开始学习的时候觉得比较难,但只要理解了,用起来是非常方便和意义确定的。JavaScript也提供了这个this关键字,不过用起来就比经典OO语言中要"混乱"的多了。 下面就来看看,在JavaScript中各种this的使用方法有什么混乱之处? 1、在HTML元素事... 阅读全文
posted @ 2009-03-04 16:15 hcmfys_lover 阅读(208) 评论(0) 推荐(0) 编辑