// Popup routines // Define array (url, x, y, blockingcookie,scrollbars,name) // tutaj wpisujesz adresy kolejnych popupow url[0]=['http://adres.pl/dziekuje.html','450','400','','no','subscribe'; url[1]=['http://adres.pl/popup.htm','450','400','','no','czy_subscribed'; var win=null; var days=1; // Number of days before next popup // Use this routine on the onclick event of any links you DON'T want popups on function setExitFalse(){ } function showPopup(popupName){ // Get the optional name parameter if(typeof(popupName) == "undefined") { // If it is not defined, use the next rotated popup pickNextRotation(); } else { var popped; // If it is defined, does that actual popup exist? for (n=0;n<url.length;n++) { // alert(url[n][5] + ? ? + popupName); if (url[n][5] == ?) { // It doesn?t exist, use a rotation popup pickNextRotation(?nocheck?); popped = true; } else if (url[n][5] == popupName) { // It does exist, use that popup NewWindow(url[n][0],?popup?,url[n][1],url[n][2],?custom?,'front?,url[n][4],?nocheck?); popped = true; break; } } if (!popped) { pickNextRotation(?nocheck?); } } } function pickNextRotation(checkcookie) { // Open window if cookie not found // alert(?CFC: ? + checkcookie); var i=0; // Default ID // Get the last ID used var allcookies=document.cookie; var pos=allcookies.indexOf(?popup=?); if(pos!=-1){ var start=pos+6; var end=allcookies.indexOf(?;?,start); if(end==-1) { end=allcookies.length; } var i=allcookies.substring(start,end); if (i==url.length-1) { i=0; } else { i++; } } //alert(?Start with ?+ i); if (i > url.length) { i = 0; } // Now loop until you find one that is not blocked for (j=i; j < url.length; j++) { var allowed=1; //alert (?Checking url ? + j); if (url[j][3] != ??) { // There is a blocking cookie ? find the value //alert(?Looking for cookie ? + url[j][3]); var allcookies=document.cookie; //alert(?allcookies=?+ allcookies); var pos=allcookies.indexOf(url[j][3] + ?=?); if(pos!=-1){ //alert(?Found subscribed at ? + pos); var start=pos + url[j][3].length + 1; var end=allcookies.indexOf(?;?,start); if(end==-1) { end=allcookies.length; } var cookieval=allcookies.substring(start,end); allowed = 0; } else { //alert (?Subscribed not found?); } } if (allowed==1) { //alert(?allowed?); break; } else { //alert (?not allowed:? + allowed); } } // Continue loop //alert(?Ended with ? + j); NewWindow(url[j][0],?popup?,url[j][1],url[j][2],?custom?,'front?,url[j][4],checkcookie); } // alert (checkforcookie); if (typeof(checkforcookie) == ?undefined?) { if(GetCookie(?sid?) == ?999?){ return; } } document.cookie=?sid=999; Path=/; Expires= ? + getFuture(days); } myleft=(screen.width)?(screen.width-w)/2:100; mytop=(screen.height)?(screen.height-h)/2:100; myleft=0; mytop=20; } settings=?width=? + w + ?,height=? + h + ?,top=? + mytop + ?,left=? + myleft + ?,scrollbars=? + scrollbars + ?,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes?; win=window.open(mypage,myname,settings); win.focus(); } function getFuture(f){ d.setTime(d.getTime() + (86400000 * f)); // Milliseconds! return d; } 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 null; } nextyear.setFullYear(nextyear.getFullYear()+1); document.cookie=?popup=?+i+?;path=/;expires=?+nextyear.toGMTString(); } function getCookieVal (offset) { var endstr = document.cookie.indexOf (?;?, offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); }
zapisałem to jako okno.js i wsadziłem do głównego katalogu na serwerze.
w index'ie tuż za <head> wstawiłem kod:
<script type="text/javascript" src="okno.js"></script>
Niestety skrypt nie działa.
Proszę o pomoc kogoś doświadczonego.