Hi there, I'm not very good with Javascript so I need you help for page on my website... Basically what I need to do is to make a DIV shown only first time someone visits page, and then when he/she revisit it I want that same DIV hidden, and I want it hidden for next 24 hours... so in that way DIV would be shown only once a day, and only on first page load. So to make that happen I need to do fallowing, and I would need your help for that: I need a script that on a page load checks if cookie (which is 24h cookie) is set, if it is then it should hide that DIV, if it is not set then it should set it, so that DIV would be hidden on next page load... Can someone help me with this, cause I am getting mad trying to do this whole day... Thanks people!
The following code check whether a cookie with a specified name is available. If available, then it hides a div. If not, then it creates a new cookie with expiry period as 1 day. Hope this code helps.
Hey Unni, tnx... but for some reason this wont work in my case... as you can see: www.topfm.rs/index_lightbox1.html as you can see the div I want to hide is pop up banner, but it shows every time... you can view the source code and you'll see it's the same script you gave me.. But now look: if instead of <div id ="autoload"> <a href="images/index_open.jpg" rel="lightbox" id="img"></a> </div> Code (markup): I put something like <div id ="autoload"> Some Text </div> Code (markup): IT WORKS!! It hides that text! So I guess the problem is in <a href="images/index_open.jpg" rel="lightbox" id="img"></a> Code (markup): which refuse to hide somehow!!... and you realize that I have this link/banner set to autorun on page load trough javascript so that when page loads this link (images/index_open.jpg) opens automatically.. Can you help?