View Full Version : Delete a cookie [inline code]

02-20-2007, 05:58 PM
is this the correct syntax for deleting a cookie named "weather"

<a href="" onclick="javascript:document.cookie = "weather=;";">Clear Cookie</a>

02-20-2007, 11:23 PM
No. :)

Why did you want to do this inline?
Cookie functions are a dime a dozen. You can get a cookie.js (http://www.google.com/search?source=ig&hl=en&q=cookie.js&btnG=Google+Search) file and just call the remove cookie function, assuming it is removeCookie(cookiename) like
<a href="" onclick="removeCookie('weather');">Clear Cookie</a>