var i = 0;
$('td').click(function() {
i = i + 1;
console.log(i);
console.log($(this));
// if(i % 2) {
// ...
// }else{
// ....
// }
});
var cachedCell = null;
$('td').click(function() {
var $this = $(this);
if(cachedCell === null)
return cachedCell = $this;
var targetColor = $this.attr("bgcolor");
var cachedColor = cachedCell.attr("bgcolor");
$this.attr("bgcolor", cachedColor);
cachedCell.attr("bgcolor", targetColor);
cachedCell = null;
});