一个IP只弹出一次代码

Written by aijun April 28th, 2006 11:08 PM No Comments Filed under: 资源分享

JavaScript代码
  1. <script>   
  2.   
  3. var cookieString = new String(document.cookie)   
  4. var cookieHeader = 'happy_pop=' //更换happy_pop为任意名称  
  5. var beginPosition = cookieString.indexOf(cookieHeader)   
  6. if (beginPosition <0){   
  7. window.open('http://你要弹出的ul','','top=0,left=0,width=787,height= 
  8. 480,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes');   
  9. var Then = new Date()       
  10.  Then.setTime(Then.getTime() + 12*60*60*1000 ) //同一ip设置过期时间,即多长间隔跳出一次  
  11.  document.cookie = 'happy_pop=yes;expires='+ Then.toGMTString()  //更换happy_pop和第4行一样的名称  
  12. }   
  13.   
  14. </script>   
  15. sethome()   
  16. }   
  17. //-->  
  18. </script>   

TAGS: 弹窗