窗口定时弹出

来源:互联网 发布:数据挖掘经典案例 编辑:程序博客网 时间:2024/05/16 15:14

功能:5小时弹一次+背后弹出+自动适应不同分辩率+准全屏显示

代码:
<script>
function openwin(){
window.open(http://www.6882.com,"pop1","width="+(window.screen.width-15)+",height="+(window.screen.height-170)+",left=0,top=0,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes")
setTimeout("focus();",5);
}
function get_cookie(Name) {
var search = Name + "="
var return&#118alue = "";
if (documents&#46cookie.length > 0) {
offset = documents&#46cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = documents&#46cookie.indexOf(";", offset);
if (end == -1)
end = documents&#46cookie.length;
return&#118alue=unescape(documents&#46cookie.substring(offset, end))
}
}
return return&#118alue;
}
function Set()
{
  var Then = new Date()    
  Then.setTime(Then.getTime() + 5*60*60*1000 )
  documents&#46cookie = "popped1=yes;expires="+ Then.toGMTString()
}

function loadpopup(){
if (get_cookie('popped1')=='')
{
openwin()
Set()
}
}
setTimeout("loadpopup()",5);

</script>


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/panxuan/archive/2007/11/26/1902826.aspx