<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>math</title>
  <link rel="stylesheet" type="text/css" href="style/style.css"></link>
  <script type="text/javascript" src="js/common.js"></script>
  <script type="text/javascript">  
   function test(){  
   }  
  
   function initDates(){
   var yearCom = document.forms[0].year;
   initYears(yearCom, 1973, 2020, 1981);
  
   var monthCom = document.forms[0].month;
   initMonthes(monthCom, 8);
  
   var dayCom = document.forms[0].day;
   initDays(dayCom, yearCom.value, monthCom.value);
  
   }
  
   function initYears(yearCom, start, end, defaultYear){
   for(var y = start; y <= end; y++){
   var opt = new Option(y, y);
if(defaultYear){
if(y == defaultYear){
opt.selected = true;
}
}
   yearCom.options[yearCom.options.length] = opt;
   }
   }
  
   function initMonthes(monthCom, defaultMonth){
   monthCom.options.length = 0;
   for(var m = 1; m <= 12; m++){
   var opt = new Option(fillZero(m) ,fillZero(m));
   if(defaultMonth){
   if(m == defaultMonth){
   opt.selected = true;
   }
   }
   monthCom.options[monthCom.options.length] = opt;
   }
   }
  
   function fillZero(val){
   if(val >= 10){
   return val;
   }
   return "0" + val;
   }
  
   function initDays(dayCom, year, month){
   }
  
   function isLeapYear(year){
   return false;
     }
  
  </script>
</head>
<body onload="initDates()">
<form name="form1" action="http://bbs.tarena.com.cn/">
<select name="year" id="year"></select>年
<select name="month" id="month"></select>月
<select name="day" id="day"></select>日
<input type="button" value="test" onclick="test()" />
</form>
<div id="console"></div>
</body>
</html>就这个东西吧!举个例子<body onload="initDates()">这个onload我现在不知道是干吗用的,我查帮助文档,我
感觉应该在html中的帮助文档中可以查到,但是没有,在javascript中也没找到,谁能给我讲讲怎么能正确的在
帮助文档中找到这些东西啊?

解决方案 »

  1.   

    onload 是页面加载时,调用的事件.
    以下是在dhtml 手册中的帮助文档解释onload Event  Internet Development Index --------------------------------------------------------------------------------Fires from a persistent element when the page reloads.SyntaxEvent property object.onload = handler JScript only 
    object.onload = GetRef("handler") Visual Basic Scripting Edition (VBScript) 5.0 or later only 
    Named script <SCRIPT FOR = object EVENT = onload>  Internet Explorer only Event InformationBubbles No 
    Cancels Yes 
    To invoke Load the persistent Web page from a favorite or shortcut or through an Internet address. 
    Default action Initiates any action associated with this script. The onload event for behaviors overrides the onload event for DHTML objects. Available Properties