PDA

View Full Version : code needed


cheryl
05-30-2004, 06:38 AM
What code do i need to use so that the date automatically appears on my web site and changes automatically?

olson2189
06-01-2004, 08:15 PM
Copy and paste the following script into the body of your webpage. You may need to edit this script, or all you will get is a blank page with today's date.

<SCRIPT LANGUAGE="JavaScript">
var 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<100) year="19" + time.getYear();
else year=time.getYear();
document.write("<center>" + lmonth + " ");
document.write(date + ", " + year + "</center>");
</SCRIPT>

<!-- END OF SCRIPT -->

agent002
06-02-2004, 11:05 AM
Hello Olson2189,
that code doesn't update the clock automatically :)
The code for that was posted recently here: http://www.htmlforums.com/showthread.php?s=&threadid=40556

Cheryl - You could maybe think of a little better subjects for your threads (link (http://www.htmlforums.com/search.php?s=&action=showresults&searchid=22925&sortby=lastpost&sortorder=descending)); something that actually describes the thread instead of simply "Newbie", "Help" and "code needed" (you have used all of those three subjects).

olson2189
06-02-2004, 12:06 PM
Yea, I wasn't exactly sure what she wanted, so I gave her a script that may be of some assistance.

Willy Duitt
06-02-2004, 12:24 PM
Or simply:

<script type="text/javascript">
document.write(new Date())
</script>