日期:2014-05-18  浏览次数:20665 次

JavaScript如何清除cookies?
JavaScript如何清除cookies?

------解决方案--------------------
Cookie c = new Cookie(“userId”,”landril”);
c.setMaxAge(0);
------解决方案--------------------
<script language= "Javascript ">

document.cookie = "v0=1; ";
document.cookie = "v1=2; ";

alert(document.cookie);


function deletecookie(cName)
{
var d = new Date(2000,1,1);
document.cookie = cName + "=;expires= " + d.toGMTString() + "; " + "; ";

alert(document.cookie);
}

</script>
<input onclick= "deletecookie( 'v0 ') " value= "delete v0 " type=button>