What I want to add is following:
1) Say the default or selected date is 2012-02-15. I want a text to appear says: "The selected date is: 2012-02-15"
I tried your second suggestion
var day = document.getElementById('daydropdown').value; var month = document.getElementById('monthdropdown').value; var year = document.getElementById('yeardropdown').value; var date_object = new Date(); var ts = Date.parse(year+'-'+month+'-'+day); document.getElementById('d1').innerHTML = 'The selected date is: '+ date_object.setTime(ts);
I also added in the body:
<div style="font-weight:bold" id="d1" ></div>
But all I get is ... The selected date is: NaN
In the original code the function is activated using window.onload. As far I can understand the code doesn't react when the dropdown lists are used and the date is changed... Now can I solve this?
If you did not change the element IDs from the sample: