<select id="numBoxes" onchange="displayTextboxes();">
Now the function:
var lstItems = document.getElementById('numBoxes');
var amount = lstItems.options[lstItems.selectedIndex].value;
for (var i = 0; i < amount; i++)
document.write('<input type=\'text\' name=\'someName\' /><br />');
Something like that should work.