|
|
@@ -3,15 +3,19 @@ $(function () {
|
|
|
var year=new Date().getFullYear(); //获取当前年份
|
|
|
|
|
|
var sel = document.getElementById ('project_year');//获取select下拉列表
|
|
|
- for ( var i = 2018; i < year+3; i++)//循环添加2006到当前年份加3年的每个年份依次添加到下拉列表
|
|
|
- {
|
|
|
- var option = document.createElement ('option');
|
|
|
- option.value = i;
|
|
|
- var txt = document.createTextNode (i);
|
|
|
- option.appendChild (txt);
|
|
|
- sel.appendChild (option);
|
|
|
+ if (sel) {
|
|
|
+ for ( var i = 2018; i < year+3; i++)//循环添加2006到当前年份加3年的每个年份依次添加到下拉列表
|
|
|
+ {
|
|
|
+ var option = document.createElement ('option');
|
|
|
+ option.value = i;
|
|
|
+ var txt = document.createTextNode (i);
|
|
|
+ option.appendChild (txt);
|
|
|
+ sel.appendChild (option);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
var selectYear = $("#project_year_date").val();
|
|
|
console.log(selectYear);
|
|
|
if (selectYear){
|