JavaScript live grade Calculator
Firstly, there's an error in the code you've written which will prevent the calculator from working correctly:

document.getElementById('total').value = numbergrade;


You don't have an element with the ID of total so this will fail. I'm guessing you want to change this ID to percentgrade.

You also have invalid syntax here:

var percentscore =
if (numbergrade&gt;=101) {


You need to assign a value to percentscore if you put an = sign after it. You're actually not using it in the rest of the code so you can get rid of the variable completely.



Next it can be cleaned up a bit. if (numbergrade &gt;= 101) is a little unclear, compared to the shorter and simpler if (numbergrade &gt; 100). The number 100 has meaning for a test because it's the maximum grade. The number 101 doesn't it's simply an invalid value. You could also extract this out into a variable to assign an even stronger meaning.

var MAX_OBTAINABLE = 100;

if (numbergrade &gt; MAX_OBTAINABLE) {


Note the capital casing to indicate a constant. In more modern iterations of javascript you can actually create a true constant by using the const keyword rather than var or let

const MAX_OBTAINABLE = 100;




The next part which needs to be changed is your rendering of the values. Your percentgrade element is a textbox, so you should be setting it's value property. Currently you are setting the innerHTML which won't work.

document.getElementById("percentgrade").innerHTML = 


Should become

document.getElementById("percentgrade").value = 




The last part where you calculate the grade letter, could also do with some improvements. Whenever you find yourself using the same calculated more than once or twice, it becomes a good candidate to store in a variable. In this case, you've written document.getElementById('letter') many times. You can shorten in by extracting it into a variable before you start to determine the grade letter

var letterDisplay = document.getElementById('letter');

if (numbergrade &gt;= 90) {
    letterDisplay.value = 'A+';
}
else if (89 &gt;= numbergrade &amp;&amp; numbergrade &gt;= 85){
    letterDisplay.value = "A";
}

// ... etcetera


On this first line you've also attempted to assign the variable lettergrade to an if statement which is invalid syntax.

var lettergrade = if(numbergrade >= 90) {

You don't seem to be using this variable so you could get rid of this assignment. However, you could actually use that variable to make the above code even shorter. Starting off with the letter grade set to F we can do the following:

var letterDisplay = document.getElementById('letter');
var lettergrade = 'F';

if (numbergrade &gt;= 90) {
    lettergrade = "A+";
}
else if (89 &gt;= numbergrade &amp;&amp; numbergrade &gt;= 85) {
    lettergrade = "A";
}

// .... all the other if statements here.

else if (54 &gt;= numbergrade &amp;&amp; numbergrade &gt;= 50) {
    lettergrade = 'D';
}

letterDisplay.value = lettergrade;


There are some more ways you could improve on this, but that's a few of the basic, for some slightly more advanced concepts like objects, functions and looping, take a look at this JS fiddle I created and have a play around