如题所述
ååå½æ°(ç±ç±»ç对象è°ç¨) testClass.prototype.walk = function(){ //åªè½è®¿é®:å
¨å±åéåå
¨å±å½æ° this.where = function(){ alert("Where can we go?"); go(); } var go = function(){ alert("go name:"+name); alert("go add(1,1):"+add(1,1)); } } </script> ä¸é¢ççå¦ä½è°ç¨: <script type="text/javascript"> //è·åä¸ä¸ªcbsç±»çå®ä¾ var cbs= new testClass(); //è°ç¨ç±»ç对象å±æ§age alert("age:"+cbs.age); //è·åç±»å½æ°talkçå®ä¾ var talk = new testClass.talk(); //è°ç¨ç±»å½æ°çå®ä¾å½æ° talk.what(); //è·åååå½æ°walkçå®ä¾ var walk = new cbs.walk(); //è°ç¨ååå½æ°çå®ä¾å½æ° walk.where(); </script> å¾
温馨提示:答案为网友推荐,仅供参考