sitelink1  
sitelink2  
sitelink3  
sitelink4 http://1 
extra_vars4 ko 
extra_vars5 http://www.taeyo.net/Forum/Content.aspx?SEQ=21743&TBL=JSCRIPT&PGN=1 
extra_vars6 sitelink1 
1. 첫번째 질문

  1. /*부모클래스*/     
  2. function NxControl(containerElement) {   
  3.    this.GetText=function()  {   
  4.       return "부모입니다.";   
  5.   }   
  6. }   
  7.   
  8. /*----------------------------------------------------------------*/
    /*NxControl을 상속받은 자식 클래스*/  
  9. function NxViewer(containerElement) {   
  10.    NxControl.apply(this, arguments);   
  11.    this.GetText=function()  {   
  12.      return "자식입니다.";   
  13.    }   
  14. }   
  15. NxViewer.prototype = new NxControl();   
  16. /*----------------------------------------------------------------*/  
위와 같은데요.
NxViewer 에서 NxControl 의 GetText()를 호출하고 싶습니다.

·미리보기 | 소스복사·
  1. NxViewer.prototype = new NxControl();   
  2. NxViewer.prototype.constructor = NxViewer;  
상속은 위와 같이 합니다.
흔히들 두번째, 생성자를 재지정하는 걸 놓지는데 반드시 생성자를 재지정 해야 합니다.
만약 재지정하지 않을 경우 var o = new NxViewer() 와 같이 생성한 객체가 가르키는 constructor가 부모 생성자가 되어버리는 문제가 생깁니다.
이렇게 하였을 경우 부모의 GetText()를 호출 하는 방법은 아래와 같습니다.
·미리보기 | 소스복사·
  1. var o = new NxViewer();   
  2. alert(o.constructor.prototype.GetText());  
프로토타입 체인을 이해하시면 될거 같습니다.


2. 두번째 다시 질문

답변 감사합니다.
아래와 같이 코딩했더니

·미리보기 | 소스복사·
  1. /*부모클래스*/    
  2.  function NxControl(containerElement)   
  3. {      
  4.     this.GetText=function()     
  5.    {         
  6.       alert( "부모입니다.");     
  7.    }   
  8. }   
  9. /*----------------------------------------------------------------*/  
  10. /*NxControl을 상속받은 자식 클래스*/  
  11. function NxViewer(containerElement)   
  12. {      
  13.     NxControl.apply(this, arguments);      
  14.     this.GetText=function()     
  15.    {        
  16.        alert( this.constructor.prototype.GetText() );   
  17.    }   
  18. }   
  19. NxViewer.prototype = new NxControl();   
  20. NxViewer.prototype.constructor = NxViewer;   
  21. var ctl = new NxViewer();   
  22. ctl.GetText();  

"부모입니다" 가 찍히긴 하는데요. 연이어 'undefined' 앨럿창도 떠버리네요.
'undefined' 가 안뜨게 할 수 있는 방법이 있을까요? ^^

리턴값이 존재 하지 않아서 뜨는 문제 입니다.
아래 참고 하세용.
·미리보기 | 소스복사·
  1. /*부모클래스*/    
  2.  function NxControl(containerElement)   
  3. {      
  4.     this.GetText=function()     
  5.    {         
  6.       //alert( "부모입니다.");     
  7.      return "부모값";  
  8.    }   
  9. }   
  10. /*----------------------------------------------------------------*/  
  11. /*NxControl을 상속받은 자식 클래스*/  
  12. function NxViewer(containerElement)   
  13. {      
  14.     NxControl.apply(this, arguments);      
  15.     this.GetText=function()     
  16.    {        
  17.        alert( this.constructor.prototype.GetText() );   
  18.    }   
  19. }   
  20. NxViewer.prototype = new NxControl();   
  21. NxViewer.prototype.constructor = NxViewer;
    var ctl = new NxViewer();   
  22. ctl.GetText();  
... 음
번호 제목 글쓴이 날짜 조회 수
106 Dynatrace For Ajax Performance 황제낙엽 2010.08.18 437
105 javascirpt IME-Mode 설정하기 황제낙엽 2010.08.17 1481
104 Iframe 내의 페이지 접근방법 황제낙엽 2009.11.12 432
103 외부 라이브러리 (.js) 의 바람직한 동적 로딩 (The best way to load external JavaScript) 황제낙엽 2009.10.05 698
102 숫자값으로의 변환 형태 황제낙엽 2009.09.02 449
101 Boolean 데이터 타입 황제낙엽 2009.09.02 466
100 toString 변환 테이블 황제낙엽 2009.09.02 441
99 URI 인코딩을 해야 하는 문자들 황제낙엽 2009.09.02 408
» 체인 생성자(생성자 체인), 프로토타입 체인 그리고 생성자 재지정 황제낙엽 2009.08.12 399
97 이미지 로드 코드 황제낙엽 2009.06.27 515
96 자동 형변환 (문자열 -> 숫자) 황제낙엽 2009.06.25 483
95 자바스크립트 쿠키 황제낙엽 2009.06.11 451
94 이클립스에 Aptana 플러그인 설치하기 (자바스크립트 개발에 유용한 IDE) 황제낙엽 2009.04.17 460
93 [JavaScript Tutorials] Error handling in JavaScript using try/catch/finally - The Error object and throwing your own errors (해석중) 황제낙엽 2009.04.10 474
92 [JavaScript Tutorials] More leakage patterns (해석중) 황제낙엽 2009.04.10 470
91 [JavaScript Tutorials] Introducing the closure (해석중) 황제낙엽 2009.04.10 983
90 [JavaScript Tutorials] JavaScript and memory leaks (해석중) 황제낙엽 2009.04.08 526
89 [JavaScript Tutorials] Handling runtime errors in JavaScript using try/catch/finally (해석중) 황제낙엽 2009.04.08 3221
88 JavaScript Closures for Dummies 황제낙엽 2009.04.08 692
87 테이블 엘리먼트 생성 스크립트 황제낙엽 2009.04.07 449