magnetica Posted April 7, 2007 Share Posted April 7, 2007 I have tried many examples of how to delete cookies with javascript but none seem to work. I'm not great at javascript but heres what I have:- function delete_cookie ( cookie_to_delete ) { var cookie_date = new Date ( ); // current date & time cookie_date.setTime ( cookie_date.getTime() - 1 ); document.cookie = cookie_to_delete += "=; expires=" + cookie_date.toGMTString(); } I then call it on the page load like so: <body onload="deleteCookie"> Can anyone explain why its not working? Or please provide me with an example that does, Thanks a lot Quote Link to comment Share on other sites More sharing options...
Vikas Jayna Posted April 7, 2007 Share Posted April 7, 2007 Well The following things are to be looked at:- 1) the function name is delete_cookie but the call to the function is deleteCookie. 2) also the function requires a parameter cookie_to_delete and no parameter is being passed to the function. Quote Link to comment Share on other sites More sharing options...
tarun Posted April 7, 2007 Share Posted April 7, 2007 Yep Vikas Is Right It Should Be <body onload="delete_cookie(CookieName);"> Topic Solved...? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.