Forum Moderators: open
theDate= new Date();
months = new Array();
days = new Array();
months[1] ="jan.gif";
months[2] ="feb.gif";
months[3] ="mar.gif";
months[4] ="apr.gif";
months[5] ="may.gif";
months[6] ="june.gif";
months[7] ="jul.gif";
months[8] ="aug.gif";
months[9] ="sep.gif";
months[10] ="oct.gif";
months[11] ="nov.gif";
months[12] ="dec.gif";
days[1] ="1st.gif";
days[2] ="2nd.gif";
days[3] ="3rd.gif";
days[4] ="4th.gif";
days[5] ="5th.gif";
days[6] ="6th.gif";
days[7] ="7th.gif";
days[8] ="8th.gif";
days[9] ="9th.gif";
days[10] ="10th.gif";
days[11] ="11th.gif";
days[12] ="12th.gif";
days[13] ="13th.gif";
days[14] ="14th.gif";
days[15] ="15th.gif";
days[16] ="16th.gif";
days[17] ="17th.gif";
days[18] ="18th.gif";
days[19] ="18th.gif";
days[20] ="20th.gif";
days[21] ="21st.gif";
days[22] ="22nd.gif";
days[23] ="23rd.gif";
days[24] ="24th.gif";
days[25] ="25th.gif";
days[26] ="26th.gif";
days[27] ="27th.gif";
days[28] ="28th.gif";
days[29] ="29th.gif";
days[30] ="30th.gif";
days[31] ="31st.gif";
function printDate() {
document.write('<img src="' + months[theDate.getMonth()+1] + '">'); // month
//document.write('<br>');
//document.write('<img src="' + days[theDate.getDate()] + '">'); // day
}
const theDate = new Date();
const months = [
"jan.gif",
"feb.gif",
"mar.gif",
"apr.gif",
"may.gif",
"june.gif",
"jul.gif",
"aug.gif",
"sep.gif",
"oct.gif",
"nov.gif",
"dec.gif"
];
const days = [
"1st.gif",
"2nd.gif",
"3rd.gif",
"4th.gif",
"5th.gif",
"6th.gif",
"7th.gif",
"8th.gif",
"9th.gif",
"10th.gif",
"11th.gif",
"12th.gif",
"13th.gif",
"14th.gif",
"15th.gif",
"16th.gif",
"17th.gif",
"18th.gif",
"18th.gif",
"20th.gif",
"21st.gif",
"22nd.gif",
"23rd.gif",
"24th.gif",
"25th.gif",
"26th.gif",
"27th.gif",
"28th.gif",
"29th.gif",
"30th.gif",
"31st.gif"
];
function printDate() {
document.write('<img src="' + months[theDate.getMonth()] + '">'); // month
//document.write('<br>');
//document.write('<img src="' + days[theDate.getDate() - 1] + '">'); // day
}
<div id="currentDate"></div>
function printDate() {
const content = '<img src="' + months[theDate.getMonth()] + '">';
document.querySelector('#currentDate').innerHTML = content;
}