It may be easer to do that in PHP:
$val = round(value('D221_13'));
var scoreA = document.getElementById("D221_13");
var scoreB = document.getElementById("D221_14");
scoreB.value = Math.round(parseFloat(scoreA.value));
but ... better use the PHP code, no need to move that from the server to the browser.