Еще вариант
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<input id="mig" type="text" value="10">
<input onclick="setMig()" type="button" value="SET">
<script>
var setMig = function () {
var quantity = +document.getElementById('mig').value,
body = document.body || document.getElementsByTagName('body')[0];
quantity && blink(body, quantity, 'red');
},
blink = function (element, quantity, color) {
var i = 0,
quantity = quantity * 2,
animTimer = setInterval(function () {
element.bgColor = element.bgColor ? '' : color;
++i == quantity && clearTimeout(animTimer);
}, 500);
};
</script>
</body>
</html>