- 论坛徽章:
- 0
|
- <script type="text/Javascript">
- function update_change()
- {
- update=document.getElementById('update').value;
- week_date = new Date();
- day = week_date.getDay();
- if (day == "0")
- {
- day = 7 ;
- }
- month_day = week_date.getDate();
- // now_str = week_date.getFullYear()+"-"+ (week_date.getMonth()+1)+"-"+week_date.getDate();
- differ = 7 - day + 1;
-
- endtime = new Date();
- arr = update.split("-");
- update_format = new Date(Date.UTC(arr[0],arr[1]-1,arr[2],'0','0','0'));
- now_format = new Date(Date.UTC(week_date.getFullYear(),(week_date.getMonth()),week_date.getDate(),'0','0','0'));
-
- update_format = (update_format.getTime()/1000);
- endtime_format = (now_format.getTime()/1000+differ*24*60*60);
- //alert(endtime_format);
- //alert("end "+endtime_format+" upd "+update_format);
- if (update_format >= endtime_format)
- {
- plan = "是";
- sl_plan_obj = document.getElementById('select_isplan');
- sl_plan_obj.options.length=0;
- sl_plan_obj.options.add(new Option(plan,"value"));
- alert("是")
- }
- else
- {
- plan = "否";
- sl_plan_obj = document.getElementById('select_isplan');
- sl_plan_opbj.options.length=0;
- sl_plan_obj.options.add(new Option(plan,"value"));
- alert("否");
- }
-
- }
- </script>
- <td height="28" >变更日期:
- <input class="update" name="update" type="text" id="update" >
- <font color="#FF0000">*</font>
- <input type="button" id="time_sure" name="time_sure" value="确定" onclick="update_change();"> </td>
- <td height="28" ><label>是否计划:
- <select class="sl_normal" name="select_isplan" id="select_isplan">
- <option>是</option>
- <option>否</option>
- </select></label></td>
复制代码 当我输入日期 2011-12-28 这样的形式
option就会删除 增加一个是或者否选项
可是这里我的原因是if 块里面的会执行 else永远都不会执行。。。条件逻辑我测试过是对的
不知道为什么。。。不知道俺说的清楚清楚。。求各位帮下 |
|