Как вариант...
<!DOCTYPE html>
<html>
<head>
<script src='http://code.jquery.com/jquery-latest.js'></script>
<!--
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
<link rel='stylesheet type=text/css href=tmp.css' />
-->
<style type='text/css'>
#test {
background-color: #dddddd;
}
</style>
<script type='text/javascript'>
$(function(){
for (var i=0; i<10; ++i){
(function(e){
setTimeout(function(){
var o=$('#test');
if (o.data('iteration')==1){
o.css('background-color','#dddddd');
o.data('iteration',2);
} else {
o.css('background-color','red');
o.data('iteration',1);
}
},5000*(i+1));
})(i)
};
});
</script>
</head>
<body>
<div id='test'>Test</div>
</body>
</html>
|