JavaScript?е??к????
???????????? ???????[ 2012/12/11 10:41:51 ] ????????
????JavaScript???????????????????????????????????????????prototype??
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????ж????????????????д???????????д??
<script type="text/javascript"> function load() {
function obj1() {//????obj1
}
function obj2() {//????obj2
}
obj2.prototype = new obj1(); //obj1?????obj2?????
Object.prototype.foo = function () {
alert("object"); //Object????foo????????object
}
testobj = new obj2(); //obj2????????????testobj
testobj.foo(); //??в???????foo????
obj1.prototype.foo = function () {
alert("obj1"); //??obj1????????foo??????
}
testobj.foo(); //?????в???????foo????
}
window.onload = load;
</script>
???????н????
?????????????
??????????????????obj1??obj2????obj1?????????obj2????Object?????????????foo???‘Object’?????obj2????????????testobj?????testobj?е?foo??????????????е???Object?е?foo????????????????????δ?testobj---obj2---obj1---Object????????Object????????foo??????????????????????????????????????obj1???????????foo????????????testobj??foo??????????????е???obj1??foo???????obj1дfoo??????????д???????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11