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 toString 변환 테이블 황제낙엽 2009.09.02 428
105 [Copilot] JavaScript로 서버에 특정 값을 POST 방식으로 전달하고 응답을 기다리지 않고 바로 종료 황제낙엽 2024.05.31 427
104 charcode 32와 160 차이 (javascript char 160 to 32) 황제낙엽 2019.05.11 427
103 XMLHttpRequest.setRequestHeader 황제낙엽 2013.09.30 427
102 Methods and properties of Microsoft.XMLDOM 황제낙엽 2005.12.04 427
101 이클립스에 Aptana 플러그인 설치하기 (자바스크립트 개발에 유용한 IDE) 황제낙엽 2009.04.17 426
100 자바 스크립트 플러그인 황제낙엽 2005.11.22 426
99 User Agent 관련 Reference URL 황제낙엽 2011.02.22 425
98 getBoundingClientRect in FF3 file 황제낙엽 2013.01.11 424
97 URL 리다이렉트 (redirect) 황제낙엽 2008.04.18 424
96 javascript replaceall의 방법에 따른 처리 속도 비교 황제낙엽 2009.02.11 423
95 익명함수의 사용 황제낙엽 2008.10.14 422
94 HTTP 접근 제어 (CORS) 황제낙엽 2017.05.29 421
93 [JavaScript Tutorials] Error handling in JavaScript using try/catch/finally - The Error object and throwing your own errors (해석중) 황제낙엽 2009.04.10 421
92 Rhino 와 env.js 를 사용해서 자바 서버에서 javascript 를 구동해보자 file 황제낙엽 2012.02.15 420
91 JSAPI User Guide 황제낙엽 2008.07.14 420
90 Alert 에서의 개행처리 황제낙엽 2012.03.09 419
89 멤버 연산자 황제낙엽 2014.12.30 418
88 Iframe 내의 페이지 접근방법 황제낙엽 2009.11.12 417
87 [펌] 아사페릴의 사생활 - 싱글톤 패턴을 지향한 Javascript Module Pattern 황제낙엽 2009.04.02 417