Click to See Complete Forum and Search --> : Link color change
nevermind_br
11-13-2003, 08:33 PM
how can I change a link color, setting date for the link?
Ill explain:
there is a list of links that some are older than others...
I want to set date for this links
1 month old - green
2 months old - red
3 months old or more - blue
I want that in javascript, setting date in the "a href" or something like that. no use of ASP PHP or similar...
thanks!
:confused:
Computerman45
11-13-2003, 08:49 PM
That depends ... do you want the proccess to be automated or do you want to manually put in a class="" into the link tag?
nevermind_br
11-13-2003, 09:07 PM
I want it auto, just setting the link date... or something like that...
today the class can be "1month" but 3 months later it must change to "3months" automatic
nevermind_br
11-14-2003, 05:47 AM
impossible?????
nevermind_br
11-14-2003, 11:19 AM
last time I ask.... is it possible or not?
Computerman45
11-14-2003, 03:00 PM
I think that is impossible, or at least beyond my expertise ...
Charles
11-14-2003, 03:14 PM
How would you determine how old a link was? D you want something that polls each site to get its date of last update? Do you want to track when the user last clicked on the link? Do you want to hard code dates in your page?
nevermind_br
11-14-2003, 05:54 PM
------- How would you determine how old a link was?
I dont know were to put. but it will be manually.
Its simple. but I cant imagine how to do it.
I have a simple ASP solution, but I cant use it.
------ D you want something that polls each site to get its date of last update?
no, its just a link added today that is "green" but when it gets 3 months old become "red"... 6 months "blue"....
------ Do you want to track when the user last clicked on the link?
no
Charles
11-14-2003, 09:42 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<style type="text/css">
<!--
a {color:#0f0}
a.threeMonths {color:#f00}
a.sixMonths {color:#00f}
-->
</style>
<script type="text/javascript">
<!--
linkDate = {fee:'14 November 2003', fie:'10 November 2003', foe : '10 August 2003', fum : '10 January 2003'}
threeMonthsAgo = new Date ();
threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);
sixMonthsAgo = new Date ();
sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6);
onload = function () {for (linkID in linkDate) {if (new Date(linkDate[linkID]) <= threeMonthsAgo) document.getElementById(linkID).className = 'threeMonths'; if (new Date(linkDate[linkID]) <= sixMonthsAgo) document.getElementById(linkID).className = 'sixMonths'}}
// -->
</script>
<ul>
<li><a href="fee.html" id="fee">fee</a></li>
<li><a href="fie.html" id="fie">fie</a></li>
<li><a href="foe.html" id="foe">foe</a></li>
<li><a href="fum.html" id="fum">fum</a></li>
</ul>
nevermind_br
11-15-2003, 07:29 AM
thatīs it!!
thanks