首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

JavaScript怎么清除cookies

2012-03-23 
JavaScript如何清除cookies?JavaScript如何清除cookies?[解决办法]Cookie c new Cookie(“userId”,”landr

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>

热点排行