SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, fellow SitePoint members! first posting for me, so go easy

    Subscribe Popup if visitor does Not Subscribe or Disable Popup

    I was interested in how I would do this? I assume I will need cookies to do this, but I am unsure how or what code should be on the 2 pages..


    Here's an example scenario of what I mean:

    1. visitor clicks on a link at "content_page1.htm"

    2. opens "subscribe_popup.htm" and than "index.html" both in new windows.

    Note: "subscribe_popup.htm" has a popup message asking them to subscribe via a text form & a check box option to disable the popup from reoccuring until 3 more days

    If visitor submits their email address, "subscribe_popup.htm" will not show ever again.

    Note: "index.html" should load in a new window regardless


    and, ..if I use this on all my content page links, is there a easy way to embed it into all my content pages?


    Anyone have code for this for each of these pages? Greatly appreciated! Thanks!

  2. #2
    SitePoint Member
    Join Date
    Oct 2000
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is some code for the "don't ask me again" checkbox:
    Code:
    <script>
    function never(checked) {
      var date = new Date();
      if (checked)
        date.setYear(date.getYear()+1);
      else
        date.setYear(date.getYear()-1);
      document.cookie = "never=true; expires="+date.toString();
    }
    </script>
    <input type="checkbox" onclick="never(this.checked)">
    Then on content_page1.htm you open the window like this:
    Code:
    if (document.cookie.indexOf("never=true") == -1)
      window.open("subscribe_popup.htm");


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •