Gossamer Forum
Home : General : Perl Programming :

Re: [Paul] How to convert a short javascript to perl

Quote Reply
Re: [Paul] How to convert a short javascript to perl
Thank you!
Quote Reply
Re: [maco] How to convert a short javascript to perl In reply to
Does anyone know how to change this calendar countdown javascript into perl?



var day_description = "Christmas";
var day_before = "<font face='times new roman'> <u>Christmas</u>. <b><font color=FF0000>Send <u>cards</u> as soon as possible</b></font>";

var today = new Date();
var year = today.getYear();
if ((navigator.appName == "Microsoft Internet Explorer") && (year < 2000))
year="19" + year;
if (navigator.appName == "Netscape")
year=1900 + year;
var date = new Date("April 15, 2003");
var diff = date.getTime() - today.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24));

document.write("<table bgcolor=#E6E6E6><tr><td style='width:935.1pt;border-bottom:solid navy 2.25pt'><span lang=EN-US style='font-size:9.0pt;mso-bidi-font-size:8.0pt;text-align:left'>")

if (days > 1)
document.write((days+1) + " <font face='times new roman'> days remain until " + day_description + "!");
else if (days == 1)
document.write("<font face='times new roman'><u>Only 2 days remain before </u></font>" + day_before + "!");
else if (days == 0)
document.write("<font face='times new roman'><u>Tomorrow is the day before</u></font>" + day_before + "<font color=ff0000>!</font>");
else if (days == -1)
document.write("<font size='2' face='times new roman'><font color=FF0000>TODAY</font> is</font> " + day_description + "<font size='3' face='times new roman'>! <u><font color=FF0000>Send now!</font><u> Good Luck!");
else if (days < -1)
document.write(((days+1)*-1) + (days < -2 ? " days" : " day") + "<font size='2' face='times new roman'> has passed since " + day_description + " <font size='2' face='times new roman'>Day.</font>");
document.write("</span></td></tr></table>");