Red Baron: Bitte helfen!

Beitrag lesen

Hallo, kann mir bitte jemand sagen, warum der folgende Code nicht funktioniert? Es wird immer die Farbe "rot" gesetzt.

<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("document.form.EingabeR.value", "document.form.EingabeG.value", "document.form.EingabeB.value");
  document.bgcolor = Hintergrund.hex + Hintergrund.R + Hintergrund.G + Hintergrund.B;
}
</script>

</head>
<body bgcolor="#000000">

<form name="form" action="">
<input type="text" name="EingabeR" size="2" maxlength="2">
<input type="text" name="EingabeG" size="2" maxlength="2">
<input type="text" name="EingabeB" size="2" maxlength="2">

<input type="button" value="Farbe wechseln" onclick="HintergrundWechseln()">
</form>

</body>
</html>