Actually it is correct not to work,
You're trying to destroy the session client-side with JavaScript when this can only be done server-side.
My suggestion is use your onUnload=event() event handler to open a self-destructing pop-up window that will call on the session_destroy() function.
I'm not sure of how the JavaScript goes, but it may be something simular to this...
<script language="JavaScript" type="text/javascript">
<!--
function sessiondestroyer() {
window.open("session_destroyer.php","","WIDTH=425, HEIGHT=445")
}
//-->
</script>
<body onUnload="sessiondestroyer()">
And then your session_destroyer.php script will call on the neccessary server-side PHP script to destroy sessions.
I would add an onload() event handler that called on the self.close() function to automatically get rid of the window and not annoy your surfers.
hth
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::