|
||||
|
I had one a while back but can't find it now.
I need to put a "We'll be closed" message on my site that only pops up once per day or even once every two days for each visitor. Right now, what I have pops up every visit, which could get rather annoying. See what I have here: Jim Poor Photography Anyone know how to add a cookie to it so it only pops up once per day or every two days? |
|
||||
|
Wish I knew too. Guess that's what we get for having opinions and giving out free advice.
__________________
url:www.jimbryantphotography.com http://pa.photoshelter.com/c/jimbryant http://jimbryantphotography.blogspot.com/ (3) EOS1D MKIIs', (1) EOS1Ds MKII, 14mmf2.8, 16-35mmf2.8, 28-70mmf2.8, 70-200mm f2.8, 300mm f2.8 and a 400mmf2.8. |
|
||||
|
I'm not a coder, but this might help, pop up only once??? - CodingForums.com
__________________
Lori Putman flickr ~No one can drive us crazy unless we give them the keys ~~Life isn't about waiting for the storm to pass, it's about learning to dance in the rain! 7D | 300L f/4 IS | 135L | 35L | 100/2.0 | 50/1.4 430 EX, 580 EX II Speedlites |
|
||||
|
try this...Paste this code into an external ********** file named: onlyPopupOnce.js
var expDays = 1; // number of days the cookie should last var page = "only-popup-once.html"; var windowprops = "width=300,height=200,location=no,toolbar=no,menuba r=no,scrollbars=no,resizable=yes"; 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; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.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 DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } var exp = new Date(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); function amt(){ var count = GetCookie('count') if(count == null) { SetCookie('count','1') return 1 } else { var newcount = parseInt(count) + 1; DeleteCookie('count') SetCookie('count',newcount,exp) return count } } function getCookieVal(offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function checkCount() { var count = GetCookie('count'); if (count == null) { count=1; SetCookie('count', count, exp); window.open(page, "", windowprops); } else { count++; SetCookie('count', count, exp); } } window.onload=checkCount; Then, paste this code into the HEAD section of your HTML document. ******** type="text/**********" src="onlyPopupOnce.js">***********
__________________
Nikon D7000:18-105mm VR Kit, Nikkor 35-70mm 2.8AF, Nikkor 50mm f/1.8d AF, Sigma 150-500mm f/5-6.3 AF, SB600 Web Design of Palm Beach Photo Blog Become a Fan on Facebook |
|
||||
|
i'm sure "someone" else will have a better answer...
__________________
Nikon D7000:18-105mm VR Kit, Nikkor 35-70mm 2.8AF, Nikkor 50mm f/1.8d AF, Sigma 150-500mm f/5-6.3 AF, SB600 Web Design of Palm Beach Photo Blog Become a Fan on Facebook |
|
||||
|
Thanks. That's the code that confused the crap out of me. The last one I had, I only had to paste the code into my footer (to load after the site) and there was no reference to an external doc. I know I saved it but just can't remember where or what the file was called. :-( |
|
||||
|
Just a sidenote, but could one of the mods/admins PLEASE remove the word that JS stands for from the censorship list? It's not that funny, and it's freaking annoying that everytime you type in ********** the damn word gets asterisked out. Especially with code examples, or when you're asking for website help.
__________________
I shoot with a Canon 5DmkII, 50D, and S90, and Pansonic G3. flickr stream and equipment list |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Each day we send out a quick email to thousands of DPS readers to notify them of updates. This email is just short excerpt of the first few lines of our latest post with a link if you want to read it all. You can unsubscribe from this this service at any time.
This service is provided by a third party (Feedburner) and you can subscribe to it by leaving your email address in the following field and confirming your subscription when you get an email asking you to do so.
Enter your email address for
Daily Updates:
For those wanting a weekly summary of what happens on this site this free email newsletter is probably your best option. It includes a summary of the tips posted to the site each week. This newsletter is subscribed to by over 25000 readers (many who also subscribe to the other options above) - come join the community!
To subscribe to this weekly newsletter simply add your email address to the following field and then follow the confirmation prompts. You will be able to unsubscribe at any time.
Enter your email address for
Free Weekly Newsletter: