国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

JavaScript時間操作之年月日星期級聯操作

2019-11-20 10:47:33
字體:
來源:轉載
供稿:網友

本文實例介紹了JavaScript時間操作之級聯日期選擇操作的詳細代碼,分享給大家供大家參考,具體內容如下

效果圖:

具體代碼:

<html>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=GB2312">     <title>年月日星期級聯</title>   </head>    <body topmargin="10" leftmargin="0">     <form>       <select id=year onchange="toDate();">         <script>for(i=1970;i<=2010;i++)document.write("<option>"+i+"</option>")</script>       </select>       <select id=month onchange="toDate();">         <script>for(i=1;i<=12;i++)document.write("<option>"+i+"</option>")</script>       </select>       <select id=day onchange="toDay();"></select>       <input name=weekday>     </form>     <script type="text/javascript">       var arr="日一二三四五六".split("")       function toDate(){         with(document.all){           vYear=parseInt(year.options[year.selectedIndex].text)           vMonth=parseInt(month.options[month.selectedIndex].text)           day.length=0;           for(i=0;i<(new Date(vYear,vMonth,0)).getDate();i++){day.options[day.length++].value=day.length;day.options[day.length-1].text=day.length;}         }         toDay();       }       function toDay(){         vDay=parseInt(document.all.day.options[document.all.day.selectedIndex].value)         document.all("weekday").value="星期"+arr[new Date(vYear,vMonth-1,vDay).getDay()]       }       window.onload=toDate;     </script>   </body> </html> 

希望本文所述對大家學習javascript程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 瓮安县| 大名县| 白城市| 思茅市| 桃江县| 集贤县| 栾城县| 阳东县| 瑞安市| 随州市| 永吉县| 民勤县| 义马市| 九寨沟县| 大城县| 政和县| 泸溪县| 太谷县| 武乡县| 萨嘎县| 中方县| 利辛县| 江山市| 翁牛特旗| 灵丘县| 承德市| 乌恰县| 博白县| 文成县| 秭归县| 怀柔区| 大石桥市| 庆城县| 若尔盖县| 白河县| 碌曲县| 九寨沟县| 弋阳县| 香港 | 虎林市| 湛江市|