Ehh…. event handlers go in the ‘HTML’ section, right(they are coded in HTML, although can be done in JS, and deal with JS… ugh)?
Well, reguardless my problem is simple. I have a simple AJAX chatroom. You can log on simply by entering a name. The system is very simple, but checks names to make sure no two people have the same one, and there are a few(very few) other small features.
But of course most people who ever use it don’t seem to notice or use that ‘Log Out’ button I made. More times than not they just want to close the tab(or window if they are using a non-tabbed browser([I]if those still exist…
I tried to use ‘onunload’ for the <body> tag, but this will only fire that logout function if you refresh the tab/window, or type a new address and proceed to go there. If the actual tab/window is simply closed, the function either doesn’t run, or can’t trigger fast enough.
Could it be possible that I need the onunload event on something else rather than the <body>? Maybe the document element instead? but of course how do I set a document event?