<form>
<input name="count" type="number" value="5">
<input onclick="generateBlocks(this.form.elements.count.value)" type="button" value="OK">
</form>
function generateBlocks(count) {
var fragment = document.createDocumentFragment();
for(var div, i = 0; i < +count; i++) {
div = document.createElement('div');
div.innerHTML = 'DIV #' + (i + 1);
fragment.appendChild(div);
}
document.body.appendChild(fragment);
}