//清除所有cookie函数 function clearAllCookie() { var date=new Date(); date.setTime(date.getTime()-10000); //keys为所要删除cookie的名字 var keys=document.cookie.match(/[^ =;]+(?=\=)/g); //删除所有cookie if (keys) { for (var i = keys.length; i--;) document.cookie=keys[i]+"=0; expire="+date.toGMTString()+"; path=/"; } }