WEB Javascript for closing a newsletter pop-in box?

Discussion in 'OT Technology' started by bob-dc2, Nov 28, 2009.

  1. bob-dc2

    bob-dc2 Expanse

    Joined:
    May 3, 2001
    Messages:
    8,774
    Likes Received:
    3
    Location:
    Newport Beach
    I have this setup on my site for a pop in box for newsletter sign ups.
    But it doesnt set a cookie so when the page is refreshed the box comes up again.

    This is the code im using. What should I be using?

    Code:
    <div id="new_email_popup" class="mailform">
    <form id="form" name="form" method="post" action="/mailinglist_subscribe.asp">
    <p><img src="/v/vspfiles/images/maillist.gif"><a id="new_email_popup_close" href="javascript:void(0);" OnClick="closebox('new_email_popup').style.display='none';">X</a></p>
    
    <b>Your Email:</b><br>
    <input type="text" name="emailaddress" id="email"  size="19" maxlength="50"/><br>
    
    <input name="Submit" value="Join Now" type="submit">
    
    </form></div>
    I digged around and found this code but not sure how to implement it.

    Code:
    <script type="text/javascript">
    function checkIfUserClosedBox () {
    // on load of page, check if boxclosed cookie has been set
    var c = GetCookie("boxclosed");
    if (c = "true") {
    // Hide div if true on load
    document.getElementById('box').style.display = 'none';
    }
    function closebox() {
    // hide div
    document.getElementById('box').style.display = 'none';
    
    // calculate expiry date 1 hour from now
    var d = new Date();
    d.setTime(d.getTime() + (60 * 60 * 1000));
    
    // set boxclosed cookie to true
    SetCookie("boxClosed", "true", d);
    }
    </script>
     
  2. bob-dc2

    bob-dc2 Expanse

    Joined:
    May 3, 2001
    Messages:
    8,774
    Likes Received:
    3
    Location:
    Newport Beach
    any help please?
     
  3. bob-dc2

    bob-dc2 Expanse

    Joined:
    May 3, 2001
    Messages:
    8,774
    Likes Received:
    3
    Location:
    Newport Beach
    how much do i need to pay to get this working? its bugging the hell outa me
     
  4. bob-dc2

    bob-dc2 Expanse

    Joined:
    May 3, 2001
    Messages:
    8,774
    Likes Received:
    3
    Location:
    Newport Beach
    ballz, i never got this figured out
     
  5. Kix

    Kix Jailbait tested, Milf approved

    Joined:
    Dec 17, 2001
    Messages:
    6,568
    Likes Received:
    0
    Location:
    Colorado
    I can take a look if you link me to the site.
     
  6. Mikenotmike

    Mikenotmike

    Joined:
    Jun 1, 2001
    Messages:
    6,244
    Likes Received:
    0
    Location:
    USA

Share This Page