看代码。
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>如何实现一个日期下拉菜单</title>
<script type="text/javascript">
function DateSelector(selYear, selMonth)
{
    this.selYear = selYear;
    this.selMonth = selMonth;
    this.InitYearSelect();
    this.InitMonthSelect();
    
    var dt = new Date();
    this.selMonth.selectedIndex=dt.getMonth();
}
// 增加一个最大年份的属性
DateSelector.prototype.MinYear = 2010;// 增加一个最大年份的属性
DateSelector.prototype.MaxYear = (new Date()).getFullYear();// 初始化年份
DateSelector.prototype.InitYearSelect = function()
{
    // 循环添加OPION元素到年份select对象中
    for(var i = this.MaxYear; i >= this.MinYear; i--)
    {
        // 新建一个OPTION对象
        var op = window.document.createElement("OPTION");
        
        // 设置OPTION对象的值
        op.value = i;
        
        // 设置OPTION对象的内容
        op.innerHTML = i;
        
        // 添加到年份select对象
        this.selYear.appendChild(op);
    }
}
// 初始化月份
DateSelector.prototype.InitMonthSelect = function()
{
    // 循环添加OPION元素到月份select对象中
    for(var i = 1; i < 13; i++)
    {
        // 新建一个OPTION对象
        var op = window.document.createElement("OPTION");
        
        // 设置OPTION对象的值
        op.value = i;
        
        // 设置OPTION对象的内容
        op.innerHTML = i;
        
        // 添加到月份select对象
        this.selMonth.appendChild(op);
    }
}
</script>
</head>
<body>
<select id="selYear"></select>
<select id="selMonth"></select>
<script type="text/javascript">
var selYear = window.document.getElementById("selYear");
var selMonth = window.document.getElementById("selMonth");
// 新建一个DateSelector类的实例,将select对象传进去
new DateSelector(selYear, selMonth);
</script>
</body>
</html>