<style type="text/css">
#divResult {
width:315px;
}
div[id^="box_"]{
width:200px;
height:32px;
border:2px blue solid;
}
div.clear_coment{
float:right;
margin-top:-32px;
width:100px;
height:32px;
border:1px red solid;
text-align:center;
cursor:pointer;
}
</style>
<div id="divResult" style=" color:red;">
<div id="box_0">1</div>
<div id="clear_0" class="clear_coment" onclick="Remov(this)">clear</div>
<div id="box_1">2</div>
<div id="clear_1" class="clear_coment" onclick="Remov(this)">clear</div>
<div id="box_2">3</div>
<div id="clear_2" class="clear_coment" onclick="Remov(this)">clear</div>
</div>
<script type="text/javascript">
function Remov(a) {
var id = a.id;
var id_box = id.replace("clear_","box_");
a.parentNode.removeChild(document.getElementById(id_box));
a.parentNode.removeChild(a);
}
</script>