0

これはコメントで解決されたので、正しいとマークできるものは何もありません。

以前は機能していたと確信していますが、約1年後に再度開くと、機能しなくなりました。最後のアラートが表示されない理由を知っている人はいますか? それは私の成績から私の手当を計算することになっており、最終的なalrtは個々の成績のすべてと私の合計手当を与えることになっています。

<head>
<script>
    //alert('loaded');
function Runme() {
    //alert("running");
    //grades.gradess.submit();
    var Mathematics = Number(grades.Mathematics.value);
    var OMathematics = Number(grades.OMathematics.value);
    var Sci = Number(grades.Sci.value);
    var OSci = Number(grades.OSci.value);
    var ELA = Number(grades.ELA.value);
    var OELA = Number(grades.OELA.value);
    var SS = Number(grades.SS.value);
    var OSS = Number(grades.OSS.value);
    var Elec1 = Number(grades.Elec1.value);
    var OElec1 = Number(grades.OElec1.value);
    var Elec2 = Number(grades.Elec2.value);
    var OElec2 = Number(grades.OElec2.value);
    var Elec3 = Number(grades.Elec3.value);
    var OElec3 = Number(grades.OElec3.value);
    var Owed = 0.0;
    var outString = "";
    function Calc(n, o, name) {
    var add = 0.0;
    //alert (n + "and" + o)
        if (n >= 80) {
            add = add + 0.5;
            //alert(add + "x>80")
        }
        if (n >= 90) {
                add = add + 1.5;
            //alert(add + "x>90")
        }
        if (n >= 95) {
            add = add + 1;
            //alert(add + "x>95")
        }   
        if (n > o) {
            add = add + 0.5*(n-o);
            //alert(add + "Raised grade")
        }
        if (n < o) {
            if (o > 95) { 
                add = add - 0.25*(95-n);
                //alert(add + "lowered grade")
            }
            else if (o < 95) {
                add = add - 0.25*(o-n);
                //alert(add + "lowered grade")
            }
        }
        alert("You get $" + add + " in " + name);
        outString = " " + outString + "You get $" + add + " in " + name;
        Owed = Owed + add
    };
    Calc(Mathematics, OMathematics, "Math");
    Calc(Sci, OSci, "Science");
    Calc(ELA, OELA, "Literature");
    Calc(SS, OSS, "Social Studies/History");
    Calc(Elec1, OElec1, "Elective 1");
    Calc(Elec2, OElec2, "Elective 2");
    Calc(Elec3, OElec3, "Elective 3");
    alert("hi");
    alert(outstring + " You get $" + Owed + "!");
};
</script>
</head>
<body>
<center>
<h1>Grade Calculator</h1>
<form name="grades" action="" method="get">
<br><br>Math &nbsp &nbsp &nbsp Old Math<br><input type=number size=20 name=Mathematics> <input type=number size=20 name=OMathematics>
<br><br>Science &nbsp &nbsp &nbsp Old Science<br><input type=number size=20 name=Sci><input type=number size=20 name=OSci>
<br><br>English &nbsp &nbsp &nbsp Old English<br><input type=number size=20 name=ELA><input type=number size=20 name=OELA>
<br><br>Social Studies &nbsp &nbsp &nbsp Old Social Studies<br><input type=number size=20 name=SS>
<input type=number size=20 name=OSS>
<br><br>Elective One &nbsp &nbsp &nbsp Old Elective One<br><input type=number size=20 name=Elec1><input type=number size=20 name=OElec1>
<br><br>Elective Two &nbsp &nbsp &nbsp Old Elective Two<br><input type=number size=20 name=Elec2><input type=number size=20 name=OElec2>
<br><br>Elective Three &nbsp &nbsp &nbsp Old Elective Three<br><input type=number size=20 name=Elec3><input type=number size=20 name=OElec3>
</form>
<br/>
<input type="button" value="Submit and Calculate" onclick="Runme()"/>
</center>

</body>
4

0 に答える 0