changing the background image of td onblur
Posted on 2004-09-27
Here is a simplified version of my problem: My code is too long to paste but will do it if anyone needs it
I have a table with say 4 cells (td1,td2,td3,td4)
I am changing the background image of td1 like this:
In the onclick event, I change td1 background image to "Selected" if image="unselected" and unselected=if image=selected
In the onblur event, I did the same because I want only one cell to be "selected". SO for example, of td2 is selected, then the rest are all unselected along with td1 after I move the focus away from it.
---All the above works FINE**
Now the problem:
I also have a bunch of other controls/images in the page and if I click on them, sure enough the onblur event for the td elements is fired and the selected td becomes unselected. How do I avoid this?
I tried the following so that you know;
tried decalring a variable to tell me what is clicked and in the onblur event handler for tds, tried to change the image only when the variable contains the td ID BUT obviously, the variable is not set to anything else because the onblur occurs first.
So what do I do?
I do not want that to happen