<SCRIPT LANGUAGE="JavaScript">
<!--
function foo(){
  var $s="";
  for(var $i=1940;$i<=2004;$i++){
       for(var $j=1;$j<=12;$j++){
   $m=($j.toString().length<2)?(0+$j.toString()):$j;
   $s+="<option value=\""+$i+$m+"\">"+$i+"&Auml;ê"+$m+"&Ocirc;&Acirc;"+"</option>";
   }
  }
  document.write($s);
}//-->
</SCRIPT>
<select>
<script>foo();</script>
</select>

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <HTML>
    <HEAD>
    <META http-equiv="Content-Type" content="text/html; charset=gb2312">
    <TITLE>无标题文档</TITLE>
    <SCRIPT language="javascript">
    <!--
    function showShortDate(name,bDate,eDate){
    this.beginDate=bDate;
    this.endDate=eDate;
    this.show=createShorDate;
    this.name=name;
    if(!this.beginDate){
    this.beginDate=1900;
    }
    if(!this.endDate){
    this.endDate=2004;
    }
    }
    function createShorDate(){
    document.write("<SELECT name=\""+this.name+"\">")
    for(var i=this.beginDate;i<=this.endDate;i++){
    for(var j=1;j<=12;j++){
    var tempJ=j.toString();
    if(tempJ.length==1){
    tempJ="0"+tempJ;
    }
    document.write("<OPTION value=\""+i.toString()+tempJ+"\">"+i.toString()+"年"+tempJ+"月</OPTION>");
    }
    }
    document.write("</SELECT>")
    }
    //-->
    </SCRIPT>
    </HEAD><BODY>
    <SCRIPT language="javascript">
    <!--
    var selDate=new showShortDate("selName");
    // selDate.beginDate=1800;
    // selDate.endDate=2012;
    selDate.show();
    var selDate=new showShortDate("selName");
    // selDate.beginDate=1800;
    // selDate.endDate=2012;
    selDate.show();
    //-->
    </SCRIPT>
    </BODY>
    </HTML>