View Full Version : Looking for a script in DHTML

12-24-2006, 04:56 AM
hey everyone, new guy here, i've seen this script everywhere and can't seem to find it anywhere. It's a window that will float out from the right side usually in about a 400x400 box and on the top and bottom or just the top allow you to click to close.

The window will float out above your content when a user enters the page but doesn't seem to show up everytime, i'm assuming it may have some type of display setting to it.

Anyone have any ideas?
Thanks in advance,

12-24-2006, 05:15 AM
or something else from http://www.dynamicdrive.com/dynamicindex8/ can probably work for your needs with some adjustments.

As for remembering to only show it once, that's likely done by a cookie. The only two ways that are really possible are to track IP address and cookie. IP would be done on the server with a database, and probably a bit more work than you'd want for this, as well as not working great, since IPs change infrequently (frequently for dialup users, though), and this would cause some users to possibly not get the popup if they currently have an IP that has already been to your site.
Using a cookie would work fine, but requires that the browser support cookies. The good news is that anything that supports javascript will support cookies, assuming it isn't turned off as a security measure.
The other downside to cookies is that they are cleared when the browser cash is cleared, so it will have no cookie every once in a while. Hopefully, though, you're "important announcement" or whatever, would rotate somewhat often, or something, so that would even make sense. Or they'd just see it every few weeks or something, which is probably fine too.
Not sure on the details of using a cookie in javascript, though, sorry. I know they are accessible with document.cookie, at least in some ways, and there is, I think a function to set them, setCookie(), but that is also in PHP, so I might just be mixing that up.

12-24-2006, 05:22 PM
thank you

12-26-2006, 10:28 PM
Nice script djr33. I dig it.

You might also want to look at Lightbox (http://www.huddletogether.com/projects/lightbox/), its a very easy solution and might be what you mean.

Here is a simple explanation on using cookies in JavaScript (http://www.w3schools.com/js/js_cookies.asp). I prefer to use PHP, but JS might be simpler if you don't know about either. If you would like help with the PHP aspect, I can provide said help.

I would set the cookie to expire in 24 hours.