Results 1 to 3 of 3

Thread: Close div layer

  1. #1
    Join Date
    Feb 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Close div layer

    I'm looking for scripts that would close div layer on click (icon) and set cookie, so the next time user visit the page, div layer will be invisible (maybe similar as on cnn page - Set your CNN edition).

    Thank you.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2008
    Location
    Denham Springs, LA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Code:
    To hide a div just do this:
    
    document.getElementById("myDiv").style.display = "none";
    
    To set a cookie do this:
    
    document.cookie = "myDiv=True;
                   expires=15/02/2003 00:00:00";
    
    To get the cookie do this:
    var x = document.cookie;
    var hideDiv = x.split(";")(0);
    if(hideDiv == "True")
       document.getElementById("myDiv").style.display = "none";
    else
       document.getElementById("myDiv").style.display = "block";
    Download, install, and learn to use Firebug

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
  •