You just need to select the text area and set the innerHTML property



var txt = document.getElementById('txt');
txt.innerHTML = x;