Navigation Menu
Alphabetical Listing
Site Contents

Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner


Developer Channel

FlashKit.com
JavaScriptSource
Developer Jobs
ScriptSearch
WebDeveloper.com
Webreference
HTMLGoodies
HTML5 Dev Center
Developer.com
jGuru.com
PHPBuilder

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

General

This script sets a cookie, with an alert window that only comes up the first time you visit the page each day. Good for calling attention to daily specials and news updates. Can be configured to work in other ways also.


Notes

  • Created by: Ted Man
  • Posted: November 21, 2007

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: dailyCookie.js


Head

Paste this code into the HEAD section of your HTML document.


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

5. From: 3433
for redirecting
08/24/2008 12:36:14

For redirecting, instead of the line:

alert('Be shure to check our daily specials!')

add this:

function redir () {ttms=window.open("http://yourURL");}function cancel () {}if (confirm("\nMESSAGE LINE 1\n MESSAGE LINE 2.")) {redir();} else cancel()

3. From: Joseph
request
11/30/2007 02:57:36

Hello

This is a cool script, How about adding a var in there like so there is two options "ok" "no thanks" then when they hit "ok" it could bring them to a url , if they hit "no thanks" then the box would just close.

Thanks in advance for listening to me, and let ,me know if you do that , I could use something like that

Great job on this thou

Joe

4. From: Lee (Admin)
12/04/2007 11:30:35

That would be a redirect cookie. You can check our cookies scripts or submit your question to the JavaScript Forum for further help.

1. From: DPM
11/26/2007 10:49:02

We need some EXAMPLES of how to use Daily Cookie besides just the JS file and <head> elements.

How do we actually USE the thing?

2. From: Lee (Admin)
12/04/2007 10:48:51

That type of information can be found in a tutorial on JavaScript cookies. You can find a few here, as well as other places on the Web.


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.