qazi_nomi,
I believe MurthyGarimella wishes to cause an event to fire when the window closes, not refreshes. window.close() closes the window.
MurthyGarimella,
There is a way to do this but it requires some coding and has some severe limitations....
You must somehow disable the refresh button, for example by opening a window without it. However, you can never FULLY disable it; a user can always press F5 or something.
Create a frames page with the onUnload event attached. You only need to make one frameset with one frame in it. Put your page in that one frame.
If this is acceptable to you, try it and tell me if it's what you need.
HTH,
Snib
<><