09-02
10
一个cookie控制的弹窗
作者:Java伴侣 日期:2009-02-10
复制内容到剪贴板 程序代码
<script>
function openpopup(){
window.open("http://www.xxx.com/","","width=300,height=300,scroolbars=no") //自己修改弹出窗口
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie('popped')!='yes'){
openpopup()
document.cookie="popped=yes"
}
}
</script>
</head>
</head>
<body onload="loadpopup()">
function openpopup(){
window.open("http://www.xxx.com/","","width=300,height=300,scroolbars=no") //自己修改弹出窗口
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie('popped')!='yes'){
openpopup()
document.cookie="popped=yes"
}
}
</script>
</head>
</head>
<body onload="loadpopup()">
评论: 0 | 引用: 0 | 查看次数: 397
发表评论