T
Treetop
I used the following script for a site to stop displaying after a date /
time, but it seems huge. Any ideas on how to make it shorter? There are
many events in this list.
function events() {
var today = new Date();
var dayarray=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
var montharray=new
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec
")
document.write('<table>');
var event = "Spirit of the Dance - 8:00 pm (<a
href=ticketorderform_spiritofthedance.html>Order Tickets</a>)";
var date = new Date("October 30, 2003");
date.setHours (23);
date.setMinutes (21);
date.setSeconds (59);
var year=date.getYear()
if (year < 1000)
year+=1900
var day=date.getDay()
var month=date.getMonth()
var daym=date.getDate()
var cdate=dayarray[day]+", "+montharray[month]+" "+daym+" "+year+" "
if (today.getTime() <= date.getTime()) {
document.write('<tr><td valign=top>');
document.write(cdate);
document.write('</td><td>- ');
document.write(event);
document.write('</td></tr>');
}
document.write('</table>');
}
time, but it seems huge. Any ideas on how to make it shorter? There are
many events in this list.
function events() {
var today = new Date();
var dayarray=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
var montharray=new
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec
")
document.write('<table>');
var event = "Spirit of the Dance - 8:00 pm (<a
href=ticketorderform_spiritofthedance.html>Order Tickets</a>)";
var date = new Date("October 30, 2003");
date.setHours (23);
date.setMinutes (21);
date.setSeconds (59);
var year=date.getYear()
if (year < 1000)
year+=1900
var day=date.getDay()
var month=date.getMonth()
var daym=date.getDate()
var cdate=dayarray[day]+", "+montharray[month]+" "+daym+" "+year+" "
if (today.getTime() <= date.getTime()) {
document.write('<tr><td valign=top>');
document.write(cdate);
document.write('</td><td>- ');
document.write(event);
document.write('</td></tr>');
}
document.write('</table>');
}