Forum Moderators: open

Message Too Old, No Replies

Display Link based on date

         

bluePhoenix

2:03 pm on Jan 6, 2005 (gmt 0)

10+ Year Member



Ok, I was having a hard time searching this forum for the information I was looking for, and looking at each individual post was pretty tedious. So if this is a duplicate post, please accept my appologies.

Ok, here is my question. I am trying to put together some JS that will display a link based on the date. IE:

If today's date is 1/5/04 or greater then it will display a link to page number 1. Then if the date is 1/12/05 or greater then display a link to page number 1 and 2, and so on.

Thanks a ton!

jatar_k

5:21 am on Jan 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld bluePhoenix,

I did a couple of G searches on 'date javascript' and came up with some good tutorials. Once you get the date done you could do a little

if (date > something) {
document.write the link
} else {
document.write the other link
}

my JS is very rusty so if that doesn't help, then my apologies, at least it serves as a welcome and a <bump> ;)

bluePhoenix

1:26 pm on Jan 7, 2005 (gmt 0)

10+ Year Member



Thank you very much, for the info and the bump. :) I will see if I can write the function for that and post it here, and see how many people can laugh at my js coding abilities. haha. :D

bluePhoenix

4:26 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



Well I did use the if() test. Here is a past of my code.

<HTML>
<HEAD>
<TITLE>Link Test</TITLE>
<SCRIPT language="JavaScript">
<!-- Hide from non-JavaScript enabled Browsers --
// Date Test
var d = new Date()

if ((d.getMonth()+1 > 1) && (d.getDate() >= 10)){
document.write("<A HREF=http://www.dbimages.com>Click Here</A>");
} else {
document.write("Failure");
}
//--End Hide -->
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>

Pretty simple just had to go rehash all my JS skills hehe. Thanks for your help folks. :\