来自 澳门金莎娱乐手机版 2019-09-21 03:53 的文章
当前位置: 金沙澳门官网网址 > 澳门金莎娱乐手机版 > 正文

点击小说内容处弹出页面代码

有些网站接了一些广告,可以不用弹窗可以用这个脚本控制实现,内容显示的地方需要有个id,因为这样好控制,不能点击任何地方都出现吧,这样可以增加用户体验。

复制代码 代码如下:

<!--
var adurl = new Array(9);
var adurl_i = 0;
adurl[0] = "//www.jb51.net/";
adurl[1] = "";
adurl[2] = "";
adurl[3] = "";
adurl[4] = "";
adurl[5] = "";
adurl[6] = "";
adurl[7] = "";
adurl[8] = "";

function getExpDate(days, hours, minutes)
{
var expDate = new Date();
if(typeof(days) == "number" && typeof(hours) == "number" && typeof(hours) == "number")
{
expDate.setDate(expDate.getDate() + parseInt(days));
expDate.setHours(expDate.getHours() + parseInt(hours));
expDate.setMinutes(expDate.getMinutes() + parseInt(minutes));
return expDate.toGMTString();
}
}

function getCookieVal(offset)
{
        var endstr = document.cookie.indexOf(";", offset);
if(endstr == -1)
{
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}

function getCookie(name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while(i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
{
return getCookieVal(j);
}
i = document.cookie.indexOf(" ", i) + 1;
if(i == 0) break;
}
return;
}

function setCookie(name, value, expires, path, domain, secure)
{
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}

function autosubmit(gourli){
     var tempa = document.getElementById("gourla");
     setCookie("isgourla","y",getExpDate(0,1,0));
     tempa.href = adurl[gourli];
tempa.click();
}

function selectFrom(iFirstValue,iLastValue){
var iChoces = Math.abs(iLastValue - iFirstValue) + 1;
return Math.floor(Math.random() * iChoces + iFirstValue);
}

document.writeln("<a id="gourla" target="_blank"></a>");
document.onclick = function(e)
{
var event = window.event || e;
var ele = event.srcElement || event.target;
if((ele.id == "acontent"||ele.tagName=="P"||ele.tagName=="p")&&getCookie("isgourla")!="y"){
        adurl_i = selectFrom(0,8);
        if(adurl_i<9){
autosubmit(adurl_i);
}
    }        
}
//-->

本文由金沙澳门官网网址发布于澳门金莎娱乐手机版,转载请注明出处:点击小说内容处弹出页面代码

关键词: