angel026,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<div><div class="cpu_in"></div></div>
<script>
function createNewDiv(i) {
return function() {
var cpu_in = document.getElementsByClassName("cpu_in")[0];
var divCpu = document.createElement('div');
divCpu.setAttribute('id', 'cpu_new_'+i);
divCpu.innerHTML = "Новый ДИВ " + i;
var parent = cpu_in.parentNode;
parent.insertBefore(divCpu, cpu_in); //создаю ДИВ
i++;
}
}
createNewDiv = createNewDiv(77);
createNewDiv()
createNewDiv()
createNewDiv()
</script>
</body>
</html>