Niels: Eigene Objekte definieren

Beitrag lesen

Hallo, durch was kann man this ersetzen wenn man eine vollständige Angabe machen möchte?
Ist es bgcolor.R oder so?

Gruss, Niels.

  
  
<html><head><title>Test</title>  
<script type="text/javascript">  
function Farbe (R, G, B) {  
  this.R = R;  
  this.G = G;  
  this.B = B;  
  this.hex = "#";  
}  
  
function HintergrundWechseln () {  
  var Hintergrund = new Farbe("E0", "FF", "E0");  
  document.bgColor = Hintergrund.hex + Hintergrund.R + Hintergrund.G + Hintergrund.B;  
}  
</script>  
</head><body bgcolor="#FFFFFF">  
<h1>Das eigene Farb-Objekt mit JavaScript</h1>  
<a href="javascript:HintergrundWechseln()">Hintergrundfarbe wechseln</a>  
</body>  
</html>