levu: Prototypische Erweiterung und private Variablen

Beitrag lesen

Hallo,

<html>  
<head>  
<script type="text/javascript">  
function o() {  
 var x = 'x';  
 this.y = 'y';  
 var _t = this;  
 this.method = function() {  
  try {alert(x);} catch(e) {alert('x not defined');}  
  try {alert(y);} catch(e) {alert('y not defined');}  
  try {alert(_t.x);} catch(e) {alert('_t.x not defined');}  
  try {alert(_t.y);} catch(e) {alert('_t.y not defined');}  
 }  
}  
function test() {  
 var a = new o();  
 a.method();  
}  
</script>  
</head>  
<body onload="test()">  
  
</body>  
</html>

mfg, Flo

--
sh:) fo:| ch:? rl:( br:^ n4:| ie:{ mo:| va:} de:> zu:} fl:{ ss:) ls:< js:|