<div class="htmlarea"> <textarea id="runcode94369"> <title>javascripttest</title> <script type="text/javascript"> function setDay() { var themonth=document.getElementById("month"); var themaxmonthday=31; if(themonth.value=="2") { themaxmonthday=28; } var theday=document.getElementById("day"); var tempdaylength=theday.options.length; for(var j=tempdaylength;j>0;j--) { theday.options.remove(j); } for(var i=1;i<=themaxmonthday;i++) { var theOption=document.createElement("option"); theOption.innerHTML=i+"日"; theOption.value=i; theday.appendChild(theOption); } } </script> <select id="month" onchange="setDay()"> <option value="1">1月</option> <option value="2">2月</option> <option value="3">3月</option> <option value="4">4月</option> <option value="5">5月</option> <option value="6">6月</option> <option value="12">12月</option> </select> <select id="day"> </select> </textarea><br><input onclick="runEx('runcode94369')" type="button" value="运行代码"> <input onclick="doCopy('runcode94369')" type="button" value="复制代码"> <input onclick="doSave(runcode94369)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>