ap0477: Prüfen der Existenz von HTML-Objekten

Beitrag lesen

Nochmal vielen Dank für die schnelle und sehr gute Hilfe.
Ich habe die id's geändert und die if-Bedingung sieht nun wie folgt aus.
(Es funktioniert!)

ciao
Andreas

------------------------------------------------------------------------
function doRound(x, places) {
  return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
}

function update_Gesamt() {
  var gesamt = 0;
  for (var i=0; i <= 200; i++) {
    if (document.getElementById("p_" + i + "_final")) {
      var final = parseFloat(document.getElementById("p_" + i + "_final").value);
      gesamt = gesamt + final;
    }
  }
  document.getElementById('gesamt').value = doRound(gesamt, 2);
}