bpystep,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.active{
background-color: #FF0000;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(document).ready(function() {
function mig(id, ms, cls, num) {
var timer = setInterval(function() {
$('#comm_'+id).toggleClass(cls);
!num-- && clearInterval(timer);
} , ms) }
mig(512, 500, 'active', 9)
});
</script>
</head>
<body>
<div id="comm_512">
12345
</div>
</body>
</html>