Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Member PatriotReview's Avatar
    Join Date
    Jun 2003
    Location
    Springfield, IL
    Posts
    31
    Member #
    1741
    OKAY--again on my website, I have made a popup that comes up on the index page asking people to join the newsletter.

    I decided this was best and most people who go there wont get annoyed although if they are frequent visitors and have signed up for the newsletter, they might eventually get annoyed.

    Can I write a cookie on that popup page and a form button that allows them to stop that from popping up in the future?

    t
    :beard:

  2.  

  3. #2
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    Using JavaScript you can, or if you have a host that supports a server-side coding language (ASP,PHP,JSP) you can do it with those too.
    - Brian

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Code:
    <script language="javascript">
    function setCookie(name, value) {
        document.cookie = name + '=' + escape(value) + ';';
    }
    function getCookie(name) {
        var cookies = document.cookie;
        var a = cookies.indexOf(name + '=');
        if (a == -1) return null;
        a = cookies.indexOf('=', a) + 1;
        var b = cookies.indexOf(';', a);
        b = (b == -1) ? cookies.length : b;
        return unescape(cookies.substring(a, b));
    }
    function pop() {
        if (getCookie('stopPop') != 1) window.open('popup.html');
    }
    function stopPop() {
        setCookie('stopPop', 1);
    }
    </script>
    
    <body onload="pop()">
        <button onclick="stopPop()">Don't do this to me anymore</button>
    </body>

  5. #4
    Member PatriotReview's Avatar
    Join Date
    Jun 2003
    Location
    Springfield, IL
    Posts
    31
    Member #
    1741
    Wow! That is so fantastic that you would put that up for me, and I see the logic and it looks super cool.... I just can't get it to work!

    Maybe I am doing something wrong but the cookie does not ever get written to... I put the STOP button on the top left side where you can sign up

    I just cannot figure out why it is not writing to the cookie and telling it to stop popping up!

    I have cookies on... if you would look or anyone else that can figure this out let me know.

    I am new to cookies and all , but this seems simple and straightforward....oh well.... I could use any help at all.

    THIS IS EXACTLY what I was thinking of by the way--so thanks, I just hate that I cant figure it out.

    t
    ((Check it our on www.patriotreview.com --look at the right side bar to find the STOP POPUP button.))

    thanks again.t

  6. #5
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    It works for me !!!

    Maybe you have cookies turned off in your browser?

  7. #6
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    By the way.... you don't NEED a button for the stopPop() link. You can also use a link, like this:
    Code:
    <a href="javascript:stopPop()">Don't do this to me anymore</a>

  8. #7
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    NOTE: Remove any extra line breaks and spaces added by the forum software into the script samples above.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:36 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com