Hi, how about checking the current background image directly instead of toggling a variable?
var image = $('#chess-board-flip').css('background-image'); if(image == 'url(a.jpg')) { $('#chess-board-flip').css('background-image', 'url(b.jpg'); } else { $('#chess-board-flip').css('background-image', 'url(a.jpg'); } squiddy On 3 Dez., 22:58, "Alfredo Alessandrini" <[EMAIL PROTECTED]> wrote: > Hi, > > I've write this function: > > http://dpaste.com/95869/ > > for change the background image on mouse click.... > > My problem is that there are others funcions that can change the > background image, and my the function must change the images whatever > it is: > > if there is the image "bw-board2.png" change with "bw-board.png" and > viceversa. > > There is a better system for write my function? > > Thanks, > > Alfredo