This is what I have tried to do so far but it is not what I need and I cannot figure out how to do that. I need to start from a predefined date like 2003-01-01
and an end date like 2005-12-31.
Then I need to create a loop that will get all the months and year in the range and create the option for the select tag.
Please could someone help ?
Cheers
<html>
<head>
<script type="text/javascript">
var months = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Out", "Nov", "Dec")
var now = new Date()
var yy=now.getYear();
function init()
{
var sel = document.getElementById("selDate")
var theList = sel.options
for(i=0;i<months.length;i++)
{
var n = i+1
var option = new Option(months[i]+" "+yy , yy+"."+n)
theList[i] = option
}
alert(theList.innerHTML)
}
</script>
</head>
<body onload="init()">
<form id="Form1" method="post">
<select id="selDate">
</select>
</form>
</body>
</html>
|