C
Cerebral Believer
Hi all,
I am a newbie to JavaScript and am just trying to get a script going that
will write the ful date and time to each webpage as it is viewed. Can
anyone point out what mistakes there are in my code, as it does not seem to
work? I am actually trying to learn what parts of the code do what and why,
so if anyone can take the time to explain it would be much appreciated.
Here is my script:
<script language="javascript">
<!--
function datenTimes() {
var timeNow = new Date();
var day = timeNow.getDay();
var date = timeNow.getDate();
var month = timeNow.getMonth();
var minutes = timeNow.getMinutes();
var hours = timeNow.getHours();
var seconds = timeNow.getSeconds();
document.write(day + ", ");
document.write(date);
document.write(month + ", ");
document.write(minutes + ":");
document.write(hours + ":");
document.write(seconds + ".");
document.write("This page was last updated:" + document.lastModified);
}
datenTimes();
//-->
</script>
Regards,
C.B.
I am a newbie to JavaScript and am just trying to get a script going that
will write the ful date and time to each webpage as it is viewed. Can
anyone point out what mistakes there are in my code, as it does not seem to
work? I am actually trying to learn what parts of the code do what and why,
so if anyone can take the time to explain it would be much appreciated.
Here is my script:
<script language="javascript">
<!--
function datenTimes() {
var timeNow = new Date();
var day = timeNow.getDay();
var date = timeNow.getDate();
var month = timeNow.getMonth();
var minutes = timeNow.getMinutes();
var hours = timeNow.getHours();
var seconds = timeNow.getSeconds();
document.write(day + ", ");
document.write(date);
document.write(month + ", ");
document.write(minutes + ":");
document.write(hours + ":");
document.write(seconds + ".");
document.write("This page was last updated:" + document.lastModified);
}
datenTimes();
//-->
</script>
Regards,
C.B.