首页 > 关系管理系统:js代码生成select的出生日期

关系管理系统:js代码生成select的出生日期

//page初始调用

function
pageInit() {makeYear();makeMonth();makeDay();} //产生Year function makeYear(){var year = document.getElementById("year");for(var i=1901;i<=new Date().getYear();i++){var option = document.createElement("option");option.value = i;option.innerText = i;year.appendChild(option);} } //产生Month function makeMonth() {var month = document.getElementById("month");for(var i=2;i<=12;i++){var option = document.createElement("option");if(i<10){option.value = '0' + i;option.innerText = '0' + i;}else{option.value = i;option.innerText = i;}month.appendChild(option);} } //产生day日 function makeDay() {var day = document.getElementById("day");for(var i=2;i<=31;i++){var option = document.createElement("option");if(i<10){option.value = '0' + i;option.innerText = '0' + i;}else{option.value = i;option.innerText = i;}day.appendChild(option);} }function dosubmit() {makeBirthday();makePreference();return true; } //合成出生日期 function makeBirthday(){var year = document.getElementById("year").value;var month = document.getElementById("month").value;var day = document.getElementById("day").value;var birthday = year + "-" + month + "-" + day;var input = document.createElement("input");input.type="hidden";input.name = "birthday";input.value = birthdaydocument.getElementById("customer").appendChild(input);} //合成爱好单选项 function makePreference() {var preference = "";var pres = document.getElementsByName("pre");for(var i=0;i){if(pres[i].checked==true){preference = preference + pres[i].value + ",";}}preference = preference.substr(0,preference.length-1); var input = document.createElement("input");input.type = "hidden";input.name = "preference";input.value=preference;document.getElementById("customer").appendChild(input);}

 

转载于:https://www.cnblogs.com/lichone2010/p/3178649.html

更多相关:

  • //获取某一个cookie的值 const getCookie = key => {var k = key, dc = document.cookie;if (dc.length > 0) {var s = dc.indexOf(k + "=");if (s != -1) {s = s + k.length + 1;var e = d...

  • var SGheadMapPoints = {/*obj={ maxLng: minLng: maxLat: minLat: maxCount:最大人数 minCount:最小人数 total:点位数量 }*/get: function (obj) {var arr = [];obj.maxCount || (obj.maxCount...

  • //自动搜索指定的请柬 var alertTipText = "请柬找到了,就在这个网页里面,自己仔细看吧"; var delay = 1 * 1000;//1秒后循环下一页寻找 /*获取子DOM元素在父元素里面的索引位置(是第几个元素)*/ function getNodeListIndex(childNode) {return c...

  •  获取天气情况(不支持跨域) /*json原生获取*/ function getJSON() {var XML;var url = "http://wthrcdn.etouch.cn/weather_mini?city=杭州";if (window.XMLHttpRequest) {XML = new XMLHttpRequest(...

  • 注意点: 1、    value值的设置 2、select的onchange事件                 城市地址三级联动</title... </p> </div> </div> </li><li> <div class="arcTitle clearfix"> <h3><a href="//11gx.com/5ruqwfy1j9/" target="_blank">thymeleaf : input/select/radio回显</a></h3> </div> <div class="clearfix"> <div class="arcDes"> <p>thymeleaf中不用自己去写checked="checked" selected="selected"这种代码,他自己会选。 input <input type="text" class="form-control1" id="name" name="name" th:value="${user.name}"> select... </p> </div> </div> </li><li> <div class="arcTitle clearfix"> <h3><a href="//11gx.com/j95iotgdns/" target="_blank">js获得标签</a></h3> </div> <div class="clearfix"> <div class="arcDes"> <p>js中,我们通常需要在js函数中获得调用该函数的html标签。例如在select的onchange事件中,想要获得是哪个option被选择。我们要在onchange事件对应函数(以下代码中的sel()函数)中传入this。在js中的该函数中自定义一个参数(以下代码中的fuck)用来接收。   <body>   <select οnch... </p> </div> </div> </li><li> <div class="arcTitle clearfix"> <h3><a href="//11gx.com/z240trp7m8/" target="_blank">this.options[selectedIndex]的使用</a></h3> </div> <div class="clearfix"> <div class="arcDes"> <p><select id="sel" οnchange="javascript:getSelect();"> <option value="a">选择</option> <option value="bdd">be</option> <option value="c">ce</option> <option value="d">de</... </p> </div> </div> </li><li> <div class="arcTitle clearfix"> <h3><a href="//11gx.com/g3r8avxsdu/" target="_blank">asp提供在线文章翻译的功能(转)</a></h3> </div> <div class="clearfix"> <div class="arcDes"> <p>  有时候想为我们的网页提供多语言支持,如果一种语言用一张网页来做实在太麻烦了,幸好Google提供了语言工具功能,下面介绍如何利用它来实现网页多种语言之间的转换。 作者:淘特网 出处:http://www.tot.name 注:转载请注明出处 lan.htm  <form><select name="lan"><option va... </p> </div> </div> </li><li> <div class="arcTitle clearfix"> <h3><a href="//11gx.com/omvtgb9xh7/" target="_blank">个人所得税计算器2016 by Jacksile</a></h3> </div> <div class="clearfix"> <div class="arcDes"> <p>个人所得税计算器2016 个人所得税计算器2016 税前薪资:元各项社会保险费:元起征点:35004800元应缴税款:元实发薪资:元 个人所得税计算公式 应纳税额 = 应纳税所得额 x 税率 - 速算扣除数 应纳税所得额 = 工资收入金额 - 各项社会保险费 - 起征点(3500元) 说明:如果计算的是外籍人士(包括港、澳、台),则个... </p> </div> </div> </li> </ul> </div> </div> </div> <!-- <div class="simle_box300"></div> --> </div> </section> <div class="footer-wrapper"> <div class="footer"> <p class="text-center"> ©2024 11GX.COM </p> </div> </div></body> </html>