cookie-在关闭浏览器之前弹框只弹一次
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body onload="">
<script>
function openwin(){
alert(123)
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
console.log(document.cookie)
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function loadpopup(){ //*控制弹出窗口的函数哟,
if (get_cookie('popped')==''){
openwin()
document.cookie="popped=yes"
}
}
loadpopup()
</script>
</body>
</html>