I want a user to have the option of inputing lottery number selections into a form manually OR by clicking a button that will quick-pick the numbers for them. This script below only prints the numbers but I want those numbers to appear inside of a form field. How do I do this?

<script type="text/javascript" language="javascript">
var lotto = {
max : 49,
num : 6,
mega: 1
}


function lottery() {
printNumbers(getNumbers((lotto.num+lotto.mega),lotto.max),"lotto");
}


function printNumbers(numbers,type){
for(var x in numbers){
document.getElementById(type+x).innerHTML = numbers[x];
}
}

function getNumbers(totalBalls,balls) {
var numbers = [];
for (var i = balls; i > 0; i--){
numbers.push(i);
}
numbers.sort(
function(){
return (Math.round(Math.random())-0.5);
}
);
return numbers.slice(0,totalBalls);
}
</script>