<!DOCTYPE HTML>
<html>
<head>
<style>
div[id^="Window"]{
margin:12px;
width:200px;
height:100px;
border:red solid 2px;
}
</style>
<script>
var N=0;
function ShowWindow(N){
var div = document.getElementById("Window"+N);
if (div) return false;
var div = document.createElement('div')
div.id = "Window"+N;
div.innerHTML=N;
document.body.appendChild(div);
return true;
}
function CloseWindow(N){
var div = document.getElementById("Window"+N);
if (!div) return false;
div.parentNode.removeChild(div)
return true;
}
</script>
</head>
<body>
<input type="button" onclick="ShowWindow(N);N++" value="Cоздать"/>
<input id="txt" placeholder="Введите номер" size=12/>
<input type="button" onclick="X=document.getElementById('txt').value;CloseWindow(X)" value="Удалить"/>
<br><br>
</body>
</html>