August 24th, 2001, 04:27 PM
Simple Css Question, and JS Script.
Hey guys I am looking for help on 2 things, the first being this.
I would like to links to be colored by date, which means that the newest links would look let's say Red, after a day they would appear a blue color, and after 3 days they would look green.
Those colors are just examples but you know what I mean. I have seen a few sites doing it but not recently.
My second question is does anyone have the js coding to do the following. A small check box that let's the user decide if they want things to open in new windows or the parent one. I also seen this on a site but lost the url.
Thanks for your help I think alot of people might also be interested in these simple scripts.
August 28th, 2001, 09:05 AM
When you refer to "newest", do you mean newest according to the viewer, or newest according to when you added them to the page?
September 1st, 2001, 04:51 AM
Based on age added, and if it has been clicked or not.
News links one color older ones another color olderest links yet another color.
September 1st, 2001, 02:14 PM
The only way you could do that, is if you either had access to the viewer's history (which you don't) or if you kept track of all the users that came to your site. You could do this either by IP address or by cookie, however, the latter would be much more reliable as IP addresses can be dynamic.
So, you would have to store a cookie for each visitor, storing the timestamp of when a URL was accessed and the URL. However, you can only do that if you host the URL (by placing the code for storing the cookie *on* that page). It should be relatively simple, because you can use the same code on all the pages, but then when it comes time to display the URLs, you will need to access all of the cookies and perform logical calculations on what color to use for displaying the link. I don't know of any "cookie-cutter" examples, though.
Now, if the URLs are not on your web site, the only way you're going to be able to do this is if you have a "buffer" page that they access (that *is* stored on your site) prior to being redirected to the actual page. However, this is only going to work if they visited the URL by clicking on your link. If they decided to visit the URL outside of your links, your links are not going to show accurate colors.