roman1980
December 12th, 2003, 03:22 PM
html
<head>
<body>
<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers
var myDate = new Date();
var myDay = myDate.getDay();
var myMonth = myDate.getMonth();
var myYear = myDate.getYear();
var myMinutes = myDate.getMinutes();
var myHours = myDate.getHours();
var mySeconds = myDate.getSeconds();
document.write("Time: " + myHours + ":" + myMinutes + ":" + mySeconds);
document.write("Date: " + myDay + "/" + myMonth + "/" myYear);
</script>
</body>
</head>
<html>
I want to display the time and date on a website. I have used the above code but nothing displays. Have I declared correctly as I am a beginner to XHTML and Javascript.
<head>
<body>
<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers
var myDate = new Date();
var myDay = myDate.getDay();
var myMonth = myDate.getMonth();
var myYear = myDate.getYear();
var myMinutes = myDate.getMinutes();
var myHours = myDate.getHours();
var mySeconds = myDate.getSeconds();
document.write("Time: " + myHours + ":" + myMinutes + ":" + mySeconds);
document.write("Date: " + myDay + "/" + myMonth + "/" myYear);
</script>
</body>
</head>
<html>
I want to display the time and date on a website. I have used the above code but nothing displays. Have I declared correctly as I am a beginner to XHTML and Javascript.