La función es:
Código PHP:
   function totalesExp(){
    var campo;
    var tope;
    var filasGrupo;
    var filasParciales;
    var total = 0;
    var value = 0;
    var valorTope = 0;
    
    for(m = 1; m <= (parseInt(document.getElementById('parcExp').value)); m++){
        campo = "filasGrExp" + m;
        filasGrupo = parseInt(document.getElementById(campo).value) - 1;
        campo = "filasParcialExp" + m;
        filasParciales = parseInt(document.getElementById(campo).value);
        for(n=(filasParciales - filasGrupo); n<filasParciales; n++){
            campo = "chkExperienciaBaremo" + n;
            if(document.getElementById(campo).checked == true){
                campo = "txtExpPuntuacion" + n;
                total += parseFloat(trim(document.getElementById(campo).value));
            }
        }
        campo = "parcialExp" + m;
        tope = "topeExp" + m;
        valorTope = parseFloat(document.getElementById(tope).value);
        document.getElementById(campo).value = total;
 
        if(valorTope != "0"){
            if(total > valorTope){
                alert("El valor de la puntuacion correspondiente a la autobaremacion para un grupo no puede pasar el tope del grupo, el valor será truncado");
                document.getElementById(campo).value = valorTope;
            }
        }
        total = 0;
        
        //Aqui calculo el total
        campo = "parcialExp" + m;
        value += parseFloat(document.getElementById(campo).value);
    }
    return value;
} 
    
 
