Your basic problem is that you are using a
SUBMIT button!
Because you are not suppressing the natural action of the submit button, after you do the increment, the submit button continues on to do its natural action...which is to SUBMIT THE <FORM>! Which means that the browser sends the form information *BACK* to the server and the server RESENDS the page back to the browser. And you have accomplished nothing.
So to start with, change from
type="submit" to simply
type="button"
Then you have two mistakes in the JS code:
Code:
test.onclick = function()
{
var x = Number(document.getElementById("textBox").value); // ensure you get a number!
x++;
// put updated number *BACK* in the value!
// text fields do NOT HAVE any innerHTML property!
document.getElementById("textBox").value = x;
}