It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum Script-archive

Html for day,date and year

Share your completed scripts.

Html for day,date and year

Postby kakarot_90 on Sun Apr 15, 2007 11:43 am

Ever wanted to put date on ur site?Cut & paste the below code.


<script language="JavaScript" type="text/javascript">
<!--
var
month = new Array();
month[0]="January";
month[1]="February";
month[2]="March";
month[3]="April";
month[4]="May";
month[5]="June";
month[6]="July";
month[7]="August";
month[8]="September";
month[9]="October";
month[10]="November";
month[11]="December";
var
day = new Array();
day[0]="Sunday";
day[1]="Monday";
day[2]="Tuesday";
day[3]="Wednesday";
day[4]="Thursday";
day[5]="Friday";
day[6]="Saturday";
today = new Date();
date = today.getDate();
day = (day[today.getDay()]);
month = (month[today.getMonth()]);
year = (today.getFullYear());
suffix = (date==1 || date==21 || date==31) ? "st" : "th" &&
(date==2 || date==22) ? "nd" : "th" && (date==3 || date==23) ? "rd" : "th"
function print_date()
{
document.write(day + "," + "&nbsp;" + date + "<sup>" + suffix + "</sup>" + "&nbsp;" +
month + "," + "&nbsp;" + year);
}
// -->
</script>
<script>
<!--
print_date();
//-->
</script>
kakarot_90
 
Posts: 9
Joined: Sun Mar 25, 2007 10:40 am

Postby Tomi on Sun Apr 15, 2007 12:15 pm

Thanks for sharing :) im sure webmaster will put this into the script archive.
User avatar
Tomi
500+ Club
 
Posts: 925
Joined: Mon Jun 26, 2006 6:51 pm
Location: Essex, England

Postby SalmonBoy11 on Mon Nov 19, 2007 5:00 am

Ooh, I did that once to the status bar, but I'd forgotten the code. Thanks man.
SalmonBoy11
 
Posts: 24
Joined: Fri Nov 16, 2007 3:42 am

Re: Html for day,date and year

Postby pioneer on Fri Jan 08, 2010 11:35 am

Could you tell me the code for changing the font to Garamond?

Thanks
pioneer
 
Posts: 1
Joined: Fri Jan 08, 2010 11:25 am

Re: Html for day,date and year

Postby dflynn on Sat Jan 09, 2010 12:59 am

pioneer wrote:Could you tell me the code for changing the font to Garamond?

Thanks

You don't need javascript to change the font to Garamond, you are looking for CSS.
Make the

font-family: "Garamond", ... ;

in the css that affects the layer you are calling this in:
Code: Select all
<script>
<!--
print_date();
//-->
</script>


Should do it.
User avatar
dflynn
500+ Club
 
Posts: 860
Joined: Wed Oct 03, 2007 9:06 pm
Location: Guelph, Canada


Who is online

Users browsing this forum: No registered users and 1 guest