点击网页任何位置弹窗代码如何设置只弹一次
这是我一个点击网页任何位置弹窗代码<scriptlanguage="javascript">document.onclick=function(){window.open...
这是我一个点击网页任何位置弹窗代码 <script language="javascript"> document.onclick=function(){ window.open(' http://www.soso.com '); } </script> 可是每次点击都弹,如何设置只弹一次,或者同IP24小时内弹一次。 谢了 麻烦帮我写个,好心人一生平安
展开
2个回答
展开全部
<!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>
<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>
展开全部
加一个变量 <script type="text/javascript"> var a=0; document.onclick=function() {if(a<1){a=8;window.open(' http://soso.com ');}} </script>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询