No, the JavaScript stuff needs to be put in a NORMAL webpage, not in the logout page !
Look at your code... you wrote header("Location: ..."), and then exit() ! How do you want the rest of the code to be executed after calling exit() ?!
When I wrote the little link above, I had in mind you would put it in every page of your site, just like on many forums where there's always a logout button !
Also, you can't create a JavaScript function confirm() since there's a built-in function with that name...