Код Popup, помогите разобраться

A
На сайте с 28.02.2012
Offline
14
379

Всем привет,

Нашел код, popup, но знаний не хватает отредактировать его.

Вообщем

1) Он выводит его не посередине экрана а слева.

2) при закрытии (нажатии на крестик) хочу , что бы оно просто закрывалось, а не открывало новое окно по указанному url.

3) Не могу понять где регулируется количество показов в сутки.

Помогите плз. )

Заранее спасибо.

Вот код:

var ov = false;

function GetCookiePopTrafVal (offset) {

var endstr = document.cookie.indexOf (";", offset);

if (endstr == -1)

endstr = document.cookie.length;

return unescape(document.cookie.substring(offset, endstr));

}

function GetCookiePopTraf (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 GetCookiePopTrafVal (j);

i = document.cookie.indexOf(" ", i) + 1;

if (i == 0)

break;

}

return null;

}

function SetCookiePopTraf (name, value) {

var argv = SetCookiePopTraf.arguments;

var argc = SetCookiePopTraf.arguments.length;

var expires = (argc > 2) ? argv[2] : null;

var path = (argc > 3) ? argv[3] : null;

var domain = (argc > 4) ? argv[4] : null;

var secure = (argc > 5) ? argv[5] : false;

document.cookie = name + "=" + escape (value) +

((expires == null) ? "" : ("; expires=" +

expires.toGMTString())) +

((path == null) ? "" : ("; path=" + path)) +

((domain == null) ? "" : ("; domain=" + domain)) +

((secure == true) ? "; secure" : "");

}

function popup_gelPOPTraf()

{

day = new Date();

URL = "/сайт куда направляется при закрытии";

id = day.getTime();

eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=600,left = 276,top = 132');");

window.focus();

document.getElementById('popup_divMenuPOP').style.display = 'none';

pathname = "/";

myDomain = "/";

var largeExpDate = new Date ();

largeExpDate.setTime(largeExpDate.getTime() + (24 * 60 * 60 * 1000));

SetCookiePopTraf('poptrafnet','1',largeExpDate, "/");

}

function banner_gel(URL)

{

day = new Date();

id = day.getTime();

//eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=600,left = 276,top = 132');");

window.focus();

document.getElementById('popup_divMenuPOP').style.display = 'none';

pathname = "/";

myDomain = "/";

var largeExpDate = new Date ();

largeExpDate.setTime(largeExpDate.getTime() + (24 * 60 * 60 * 1000));

SetCookiePopTraf('poptrafnet','1',largeExpDate, "/");

}

function randomNumber(m,n) {

m = parseInt(m);

n = parseInt(n);

return Math.floor( Math.random() * (n - m + 1) ) + m;

}

function GetnoAdultKod() {

var kody = new Array();

kody[0] = '<iframe width="1000" height="600" src="http://файл.swf"></iframe>';

kody[1] = '<iframe width="1000" height="600" src="http://файл.swf"></iframe>';

kody[2] = '<iframe width="1000" height="600" src="http://файл.swf"></iframe>';

kody[3] = '<iframe width="1000" height="600" src="http://файл.swf"></iframe>';

var rand = randomNumber(0, 3);

return kody[rand];

}

poptrafnet = GetCookiePopTraf('poptrafnet');

if (poptrafnet == null){

var kod = GetnoAdultKod();

document.write('<div style="position: absolute; top:50px; left:20%; margin:auto; visibility:hidden;" id="popup_divMenuPOP"><table border="0" width="468" cellspacing="0" cellpadding="0"><tr><td bgcolor="#0780fe" style="padding-left: 10px"><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td><b>Что бы закрыть окно нажмите крестик справа</td><td bgcolor="#0780fe" width="33" style="padding-right: 2px" align="right"><a href="javascript://" onclick="popup_gelPOPTraf();"><img src="http://splogmaster.ru/upload/pop_clouse.gif" style="cursor: hand;" border="0" width="16" height="16"></a></td></tr></table></td></tr><tr><td bgcolor="#eeeeee" style="padding: 1 1 1 1px;">' + kod + '</td></tr></table></div>');

document.getElementById('popup_divMenuPOP').style.visibility='visible';

if (document.getElementById('popup_divMenuPOP').style)

window.setInterval("MovePopupWinPOP()", 10);

window.onerror=null;

document.body.scrollTop=10;

function MovePopupWinPOP() {

if (document.body.scrollTop==0)

document.getElementById('popup_divMenuPOP').style.top=document.documentElement.scrollTop+250; else

document.getElementById('popup_divMenuPOP').style.top=document.body.scrollTop+250;

}

}

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий