Aqua
JF-Expert Member
- Jul 23, 2012
- 1,657
- 1,237
Hi members
I am currently working on a web project and I want to display date in a format like Wednesday 24 January2013.I have videos by Lynda from Lynda.com and I followed that concept but something is missing and the problem with videos you can not ask the presenter.Seee the code below
html code
<CODE>
<html>
<head>
<title>Dynamic changing date display</title>
<script type="text/javascript" src="\date.js"></script>
</head>
<body></body>
</html>
java script code(the date.js file)
<CODE>
window.onload=initDate;
function initDate(){
var dayName=new Array("Sunday,"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var monName=new Array("January","February","March","April","May","June","July","August","September",
"October","November","December");
var now=new Date();
var thisMonth=now.getMonth()+1;
var dtString="Today is " + dayName[now.getDay()] + ",and the date can be written as:<ul><li>";
dtString +=now.getDate() + " " + monName[now.getMonth()] + " " + now.getFullYear() + "</li></ul>";
document.getElementById("dtField").innerHTML=dtString;
}
</CODE>
In the html code there is that id=" dtField",the dtField id is missing and in the video I dd not see it may be it is in a css file that was not shown.So I would like some help from people who are developers of websites to attain that output.
The way the code is the output should be something like Today is Wednesday and the date can be written as:
.02January2013.In the video the output displayed correctly.Once I get that I can modify it to attain what I need.
You can copy the html and js file save it,try once you succeed please let me know.This is a practical thing,if you have any concept that will give the same out put I will appreciate.Remember I have knowledge in html,css,javascript,html DOM and I am learning Jquery so whatever concept you give should apply any of the above and not a language that I am not familiar with.
Regards
Aqua
I am currently working on a web project and I want to display date in a format like Wednesday 24 January2013.I have videos by Lynda from Lynda.com and I followed that concept but something is missing and the problem with videos you can not ask the presenter.Seee the code below
html code
<CODE>
<html>
<head>
<title>Dynamic changing date display</title>
<script type="text/javascript" src="\date.js"></script>
</head>
<body></body>
</html>
java script code(the date.js file)
<CODE>
window.onload=initDate;
function initDate(){
var dayName=new Array("Sunday,"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var monName=new Array("January","February","March","April","May","June","July","August","September",
"October","November","December");
var now=new Date();
var thisMonth=now.getMonth()+1;
var dtString="Today is " + dayName[now.getDay()] + ",and the date can be written as:<ul><li>";
dtString +=now.getDate() + " " + monName[now.getMonth()] + " " + now.getFullYear() + "</li></ul>";
document.getElementById("dtField").innerHTML=dtString;
}
</CODE>
In the html code there is that id=" dtField",the dtField id is missing and in the video I dd not see it may be it is in a css file that was not shown.So I would like some help from people who are developers of websites to attain that output.
The way the code is the output should be something like Today is Wednesday and the date can be written as:
.02January2013.In the video the output displayed correctly.Once I get that I can modify it to attain what I need.
You can copy the html and js file save it,try once you succeed please let me know.This is a practical thing,if you have any concept that will give the same out put I will appreciate.Remember I have knowledge in html,css,javascript,html DOM and I am learning Jquery so whatever concept you give should apply any of the above and not a language that I am not familiar with.
Regards
Aqua