Java Script the Definitive Guide
Java Script the Definitive Guide - Adding a Java Script Date to your webpage.
Copy the code from <script language=”JavaScript”> to </script> (high lighted in burgundy) and paste it into your webpage where you want the date to appear.
1. Java Script that shows today’s date.
<script language=”JavaScript”><!– Beginvar months=new Array(13);months[1]=”January”;months[2]=”February”;months[3]=”March”;months[4]=”April”;months[5]=”May”;
months[6]=”June”;
months[7]=”July”;
months[8]=”August”;
months[9]=”September”;
months[10]=”October”;
months[11]=”November”;
months[12]=”December”;
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (year < 2000) // Y2K Fix, Isaac Powell
year = year + 1900;
document.write(“<center>” + lmonth + ” “);
document.write(date + “, ” + year + “</center>”);
// End –>
</script>
2. Java Script that subtracts 2 days from today’s date – Java Script the Definitive Guide
Ideal if you want to create a live last updated date to keep your visitors interested about your website because continuos changes are happening.
<script language=”JavaScript”><!– Beginvar months=new Array(13);months[1]=”January”;months[2]=”February”;months[3]=”March”;months[4]=”April”;months[5]=”May”;
months[6]=”June”;
months[7]=”July”;
months[8]=”August”;
months[9]=”September”;
months[10]=”October”;
months[11]=”November”;
months[12]=”December”;
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate() – 2;
var year=time.getYear();
if (year < 2000)
year = year + 1900;
document.write(“<center>” + lmonth + ” “);
document.write(date + “, ” + year + “</center>”);
// End –>
</script>
3. Java Script that subtracts 4 days from today’s date – Java Script the Definitive Guide
Ideal if you want to create a live last updated date to keep your visitors interested about your website because continuos changes
are happening.
<script language=”JavaScript”><!– Beginvar months=new Array(13);months[1]=”January”;months[2]=”February”;months[3]=”March”;months[4]=”April”;months[5]=”May”;months[6]=”June”;
months[7]=”July”;
months[8]=”August”;
months[9]=”September”;
months[10]=”October”;
months[11]=”November”;
months[12]=”December”;
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate() – 4;
var year=time.getYear();
if (year < 2000)
year = year + 1900;
document.write(“<center>” + lmonth + ” “);
document.write(date + “, ” + year + “</center>”);
// End –>
</script>
Code Works in IE and Firefox. – Java Script the Definitive Guide.
Categories
- Definitive Guide to CSS (5)
- Domains and Hosting (11)
- FREE Software (1)
- FREE Website Templates (3)
- HTML Code (14)
- Javascript Info (3)
- Making A FREE Template (8)
- Other Stuff (1)
- Photos and Images (9)
- Web Design Basics (10)
- Website Basics (1)
- Website Business (7)
- Website Do's and Don'ts (1)
- Website Elements (5)
- Website Fundamentals (1)
- Website History (9)
- Website Tools (1)
- Website Traffic (15)
- Website Types (6)
