|
|
Subject:
javascript
Category: Computers > Programming Asked by: swykpisz-ga List Price: $2.00 |
Posted:
28 Feb 2003 19:36 PST
Expires: 30 Mar 2003 19:36 PST Question ID: 169068 |
how do you display a different link for each day? |
|
Subject:
Re: javascript
Answered By: j_philipp-ga on 28 Feb 2003 22:54 PST Rated: |
Hello Swykpisz, Use the following HTML page: --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Sample: Your Daily Link</title> </head> <body> <h1>Sample: Your Daily Link</h1> <script type="text/javascript"><!-- var linkList = new Array(); var i = 1; var todaysLink = ""; var linkHtml = ""; var dateNow = new Date(); var dayOfMonth = dateNow.getDate(); linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.org"; linkList[i++] = "http://example.net"; linkList[i++] = "http://www.example.com"; linkList[i++] = "http://www.example.com"; todaysLink = linkList[dayOfMonth]; linkHtml += "<a href='" + todaysLink + "'>Today's link is " linkHtml += todaysLink + "</a> "; document.write(linkHtml); // --></script> </body> </html> ---- This client-side JavaScript displays a different link for each day of the month. You can test the effect by setting your calendar to a different day and refreshing the page. Now all that is left for you to do is to enter the 31 different links (just replace the part above that reads e.g. "http://www.example.com"). Hope this helps! | |
| |
|
swykpisz-ga
rated this answer:
You answered my question completely, thanks |
|
There are no comments at this time. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |