锘??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕一区二区在线播放,国产精品永久免费在线,久久资源在线 http://www.aygfsteel.com/javabloger/category/11545.htmlno description zh-cn Wed, 28 Feb 2007 03:18:43 GMT Wed, 28 Feb 2007 03:18:43 GMT 60 鐞嗚Вprototype http://www.aygfsteel.com/javabloger/archive/2006/05/26/48330.htmlliunix liunix Fri, 26 May 2006 06:46:00 GMT http://www.aygfsteel.com/javabloger/archive/2006/05/26/48330.html http://www.aygfsteel.com/javabloger/comments/48330.html http://www.aygfsteel.com/javabloger/archive/2006/05/26/48330.html#Feedback 0 http://www.aygfsteel.com/javabloger/comments/commentRss/48330.html http://www.aygfsteel.com/javabloger/services/trackbacks/48330.html
prototype 鏄痡avascript瀹炵幇緇ф壙鐨勫熀鏈柟娉曪紝浣嗚繖縐嶇戶鎵垮拰java絳夌戶鎵挎湁浠涔堟湰璐ㄧ殑鍖哄埆鍛?br /> 鍦?JavaScript 涓紝瀵硅薄鐨?prototype 鍦ㄨ繍琛屾湡鏄笉鍙鐨勶紝鍙兘鍦ㄥ畾涔夊璞$殑鏋勯犲嚱鏁版椂錛屽垱寤哄璞′箣鍓嶈瀹氥備笅闈㈢殑鐢ㄦ硶閮芥槸閿欒鐨勶細
o2.prototype聽
=
聽o1;
/*
* 聽聽榪欐椂鍙畾涔変簡聽o2聽鐨勪竴涓悕涓衡減rototype鈥濈殑灞炴э紝 聽聽騫舵病鏈夊皢聽o1聽璁句負聽o2聽鐨劼爌rototype銆?br />
*/
聽
//
聽---------------
聽 f2聽
=
聽
function
(){}; o2聽
=
聽
new
聽f2; f2.prototype聽
=
聽o1;
/*
* 聽聽榪欐椂聽o1聽騫舵病鏈夋垚涓郝爋2聽鐨劼爌rototype錛?br />聽聽鍥犱負聽o2聽鍦爁2聽璁懼畾聽prototype聽涔嬪墠宸茬粡琚垱寤恒?br />
*/
聽
//
聽---------------
聽 f1聽
=
聽
function
(){}; f2聽
=
聽
function
(){}; o1聽
=
聽
new
聽f1; f2.prototype聽
=
聽o1; o2聽
=
聽
new
聽f2;
/*
* 聽聽鍚屾牱錛岃繖鏃堵爋1聽騫朵笉鏄爋2聽鐨劼爌rototype錛?br />聽聽鍥犱負聽JavaScript聽涓嶅厑璁告瀯閫犲嚱鏁扮殑聽prototype聽瀵硅薄琚叾瀹冨彉閲忕洿鎺ュ紩鐢ㄣ?br />
*/
浠庝笂闈㈢殑渚嬪瓙鍙互鐪嬪嚭錛氬鏋滀綘鎯寵鏋勯犲嚱鏁?F2 緇ф壙鍙﹀涓涓瀯閫犲嚱鏁?F1 鎵瀹氫箟鐨勫睘鎬у拰鏂規硶錛岄偅涔堜綘蹇呴』鍏堝垱寤轟竴涓?F1 鐨勫疄渚嬪璞★紝騫剁珛鍒誨皢鍏惰涓?F2 鐨?prototype銆傜瑪鑰呰涓鴻繖縐嶇戶鎵挎柟娉曚笉澶熺洿瑙傦紝騫朵笖灝嗗璞$殑璁捐鏈熷拰榪愯鏈熸販鍦ㄤ竴璧?/strong>銆?/font> 灝辨槸鎷跨被鏉モ滅戶鎵庫濆彟澶栦竴涓被鐨勫疄渚嬬殑璇淬傘傘?br /> 緇х畫錛?br />
function
聽MyObject1(formalParameter){ 聽聽聽聽
this
.testNumber聽
=
聽formalParameter; }
function
聽MyObject2(formalParameter){ 聽聽聽聽
this
.testString聽
=
聽formalParameter; } MyObject2.prototype聽
=
聽
new
聽MyObject1(聽
8
聽);
var
聽objectRef聽
=
聽
new
聽MyObject2(聽
"
String_Value
"
聽);
Theinstance of MyObject2
referred to by the objectRef
variable has a prototype chain. The first object in that chain is the instance of MyObject1
that was created and assigned to the prototype property of the MyObject2
constructor. The instance of MyObject1
has a prototype, the default Object prototype that corresponds with the object referred to by Object.prototype
. Object.prototype
has a null prototype(!) so the prototype chain comes to an end at this point. 璇存槑prototype鏄被鐨勪竴涓睘鎬ц屼笉鏄疄渚嬬殑灞炴с傘傘?br /> prototype鏄竴涓摼錛岄摼鐨勫敖澶存槸Object.prototype鑰岃繖涓猵rototype鏈変竴浜泃oString()涔嬬被鐨勯氱敤鏂規硶錛屼笖榪欎釜prototype鐨刾rototype涓簄ull 鐜板湪浜嗚В浜嗘庢牱閫氳繃prototype瀹炵幇緇ф壙浜嗗惂錛?br /> 1錛屽鏋滅粰涓涓疄渚嬪姩鎬佹坊鍔犲睘鎬х殑璇濓紝榪欎釜灞炴у彧鑳藉仛鐢ㄤ簬榪欎釜瀹炰緥 2錛屽鏋滅粰涓涓被鐨刾rototype娣誨姞灞炴х殑璇濓紝榪欎釜灞炴т細鍦ㄧ被鐨勬瘡涓疄渚嬩腑浜х敓涓涓嫹璐濓紝鍗充細鍋氱敤浜庣被鐨勬墍鏈夊疄渚嬶紝浜х敓綾諱技緇ф壙鐨勬晥鏋?br /> ]]>
主站蜘蛛池模板:
扎赉特旗 |
化德县 |
喀喇沁旗 |
宿松县 |
佛山市 |
泰和县 |
高青县 |
和硕县 |
衡阳县 |
永康市 |
紫阳县 |
马关县 |
黎城县 |
乌鲁木齐县 |
镇康县 |
桃江县 |
郸城县 |
临安市 |
特克斯县 |
申扎县 |
全椒县 |
泽库县 |
大新县 |
漳浦县 |
福州市 |
蓝田县 |
张家港市 |
乌苏市 |
海安县 |
新兴县 |
宜君县 |
鄂托克前旗 |
洱源县 |
沧源 |
文安县 |
辽阳市 |
贵溪市 |
勃利县 |
辽源市 |
南投市 |
泸定县 |