<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html> <head>
</head>
<body>
<div style="width: 100px; height: 100px; background-color: red;"></div>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
var colors = ['red', 'silver', 'yellow'];
var index = 0;
$('div').click(function()
{
index++;
if (index == colors.length)
index = 0;
$(this).css('background', colors[index]);
});
</script>
</body>
</html>