点击网页任何位置弹窗代码如何设置只弹一次

发布网友 发布时间:2022-04-19 09:50

我来回答

2个回答

热心网友 时间:2022-04-24 15:39

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  <title>js弹窗代码,24小时只弹一次CsrCode.Cn</title>
  </head>
  <script language="javascript">
  //弹窗
  function setCookie(www_csrcode_cn, value, expire)
  {
  window.document.cookie = www_csrcode_cn + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
  }
  function getCookie(www_csrcode_cn)
  {
  var search = www_csrcode_cn + "=";
  if (window.document.cookie.length > 0)
  { // if there are any cookies
  offset = window.document.cookie.indexOf(search);
  if (offset != -1)
  { // if cookie exists
  offset += search.length;
  // set index of beginning of value
  end = window.document.cookie.indexOf(";", offset)
  // set index of end of cookie value
  if (end == -1)
  end = window.document.cookie.length;
  return unescape(window.document.cookie.substring(offset, end));
  }
  }
  return null;
  }
  function register(www_csrcode_cn) {
  var today = new Date();
  var expires = new Date();
  expires.setTime(today.getTime() + 1000*60*60*24);
  setCookie("csrcode_cn", www_csrcode_cn, expires);
  }
  var exitURL="http://www.7caidy.com/";//这个地方放置你的HTML代码
  function openWin() {
  var c = getCookie("csrcode_cn");
  if (c != null) {
  return;
  }
  register("csrcode_cn");
  var featureStr="''";
  featureStr="'top=0,left=0,width=300,height=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,center:no'";//这里是设置你上面的HTML弹出的高度和宽度的
  self.focus();
  var ExitWindow = window.open(exitURL,'', featureStr);
  ExitWindow.focus();
  }
  setTimeout("openWin()",5000);
  window.focus();
  </script>
  <body>

热心网友 时间:2022-04-24 16:57

加一个变量 <script type="text/javascript"> var a=0; document.onclick=function() {if(a<1){a=8;window.open(' http://soso.com ');}} </script>

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com