| You are here: DEVPPL ‹ Forum ‹ Programming ‹ HTML Forum ‹ Script-archive |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
Html for day,date and year
5 posts
• Page 1 of 1
0
Html for day,date and year
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 + "," + " " + date + "<sup>" + suffix + "</sup>" + " " +
month + "," + " " + year);
}
// -->
</script>
<script>
<!--
print_date();
//-->
</script>
<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 + "," + " " + date + "<sup>" + suffix + "</sup>" + " " +
month + "," + " " + year);
}
// -->
</script>
<script>
<!--
print_date();
//-->
</script>
- Kakarot_
- Reputation: 0
- Posts: 9
- Joined: Sun Mar 25, 2007 11:40 am
- Highscores: 0
- Arcade winning challenges: 0
0
Re: Html for day,date and year
Could you tell me the code for changing the font to Garamond?
Thanks
Thanks
- Pioneer
- Reputation: 0
- Posts: 1
- Joined: Fri Jan 08, 2010 12:25 pm
- Highscores: 0
- Arcade winning challenges: 0
0
Re: Html for day,date and year
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.
- Dflynn
- Reputation: 0
- Posts: 860
- Joined: Wed Oct 03, 2007 10:06 pm
- Location: Guelph, Canada
- Highscores: 0
- Arcade winning challenges: 0
|
|