PDA

查看完整版本 : 只弹出一次的窗口的JS代码


Tony
2004-11-18, 12:22 AM
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
function openpopup(){
window.open("anowdo.htm","","width=300,height=300")
//自己修改弹出窗口
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
//如果 cookie 已经存在
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')==''){
openpopup()
document.cookie="popped=yes"
}
}

</script>

</head>

<body onload="loadpopup()">
</body>
</html>