![]() |
javascript guru, what's problem here?
hi, i'm trying to rework a script written to show a different URL each day---it was originally written for 366 days, but i've shortened it to 13 days as a test---but does not show anything on the page.
i know nothing of javascript---can anyone tell me what's wrong? thanks! hahahahahahahahahahahahahahahahahahahahahahahahaha hahahahahahahahahahahahahahahahahahahahahahaha <HTML> <head> <title>Link Day</title> </head> <body> <table align="center" border="0" width="300" height="100" cellspacing="0" cellpadding="0"> <tr align="center" valign="top"> <td align="center" valign="top"> <script> /* Enter the 366 urls and names below you wish to go to for each day of the year. DO NOT use commas in the name or the script will not work. */ var daylinks=new Array() daylinks[1]="http://www.cnn.com,CNN" daylinks[2]="http://www.abcnews.com,ABCNews" daylinks[3]="http://www.cnet.com,ABC" daylinks[4]="http://www.geocities.com,Geocities" daylinks[5]="http://www.lycos.com,Lycos" daylinks[6]="http://www.infoseek.com,Infoseek" daylinks[7]="http://www.hotbot.com,Hotbot" daylinks[8]="http://www.tripod.com,Tripod" daylinks[9]="http://www.wsabstract.com,Website Abstraction" daylinks[10]="http://www.wired.com,Wired" daylinks[11]="http://www.hotwired.com,Hotwired.com" daylinks[12]="http://www.requestcode.com,Request Code" daylinks[13]="http://www.dynamicdrive.com,Dynamic Drive" var numdays=0 var daysa=new Array(31,28,31,30,31,30,31,31,30,31,30,31) var daysb=new Array(31,29,31,30,31,30,31,31,30,31,30,31) // for leap year var tdate=new Date() var tmonth=tdate.getMonth() var tyear=tdate.getFullYear() var tdays=tdate.getDate() remain=tyear % 4 if(remain!=0) // if not leap year { for(x=0;x<tmonth;x++) { numdays=numdays+daysa[x] } } else // if leap year { for(x=0;x<tmonth;x++) { numdays=numdays+daysb[x] } } today=numdays+tdays ranlink=daylinks[today].split(",") // separate the address and name document.write("The featured link for today is: <a href='"+ranlink[0]+"' title='"+ranlink[1]+"' target='_new'>"+ranlink[1]+"</a>") document.close() </script> </td> </tr> </table> </body> </html> |
Cou cant just use a script for a year. So use 366 days, or dont use it.
Do you want a random link script? |
Quote:
but i only want maybe 60 days. the application is for a content rotation thing i'm doing in a member's area. |
try replacing the line that says:
Code:
today=numdays+tdays Code:
today=(numdays + tdays) % daylinks.length Code:
daylinks[0]="http://www.cnn.com,CNN" |
Quote:
great, it does resolve, and does not change on refresh, and i hope it will change again tomorrow. you are a king! THANKS SO MUCH!!!!!!!! |
I know I am :)
|
All times are GMT -7. The time now is 02:57 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123