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