标签:blog http io os ar java sp div on
1,原型链
1 <script type="text/javascript">
2 function A()
3 {
4 this.name=‘a‘;
5 }
6 function B()
7 {
8
9 }
10
11
12 B.prototype=new A();
13 var obj=new B();
14
15 alert(obj.name);
16 </script>
2,对象冒充
1 <script type="text/javascript">
2 function A()
3 {
4 this.name=‘a‘;
5 }
6 function B()
7 {
8 A.call(this);
9 }
10
11 var obj=new B();
12
13 alert(obj.name);
14 </script>
标签:blog http io os ar java sp div on
原文地址:http://www.cnblogs.com/chenqiushi/p/4014435.html