<body>
<div id="data">
<input type="text" />
<input type="text" />
<input type="text" />
</div>
<script>
var data = document.getElementById('data'),
allInput = data.querySelectorAll('input'),
len = allInput.length;
data.oninput = function (e) {
e = e || window.event;
var target = e.target || e.srcElement;
if ('INPUT' != target.tagName) return false;
var thisValue = target.value;
if (thisValue <= 0 || thisValue > 5 || isNaN(thisValue)) target.value = '';
for (var i = 0; i < len; i++) {
if (target == allInput[i]) continue;
if (thisValue == allInput[i].value) target.value = '';
}
}
</script>
</body>