<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>一个层关闭之后,就算刷新页面了也不显示。除非关闭页面再次打开</title>
<style type="text/css">
#myDiv{
border:1px solid red;
background:#cccccc;
width:100px;
height:100px;
}
#mySpan{
cursor:pointer;
}
</style>
<script language="JavaScript" type="text/javascript">
function closeDiv(){
document.getElementById("myDiv").style.display = "none";
document.cookie = "isClose";
}
window.onload = function(){
var arrStr = document.cookie;
if(arrStr.indexOf("isClose") > -1){
closeDiv();
}
}
</script>
</head>
<body>
<div id="myDiv"><span onclick="closeDiv()" id="mySpan">关闭</span></div>
</body>
</html>