zoukankan      html  css  js  c++  java
  • 时间相加减(小森请假流程)

    HTML:
    1. <tablewidth="100%"class="td-min-height"border="1">
    2. <tbody>
    3. <trclass="firstRow">
    4. <tdwidth="1373"valign="top">
    5. <p>
    6. <imgname="OTHER_1"title="日期控件:开始"align="absMiddle"class="DATE"style="width:18px; height:18px; cursor: pointer;"alt=""src="/static/images/form/calendar.png"border="0"value="开始"date_format="yyyy-MM-dd HH:00"classname="DATE"/><inputname="DATA_65"title="开始"align="left"style="text-align: left;"onkeyup="enfocus()"onclick="enfocus()"type="text"hidden="0"/>
    7. </p>
    8. <p>
    9. <imgname="OTHER_2"title="日期控件:结束"align="absMiddle"class="DATE"style="width:18px; height:18px; cursor: pointer;"alt=""src="/static/images/form/calendar.png"border="0"value="结束"date_format="yyyy-MM-dd HH:00"classname="DATE"/><inputname="DATA_66"title="结束"align="left"style="text-align: left;"onkeyup="enfocus()"onclick="enfocus()"type="text"hidden="0"/>
    10. </p>
    11. <p>
    12. 时间差:<inputname="DATA_67"title="时间差"align="left"id="DATA_67"onclick="enfocus()"style="text-align: left;"type="text"hidden="0"/>
    13. </p>
    14. </td>
    15. </tr>
    16. </tbody>
    17. </table>
    18. <p>
    19. <br/>
    20. </p>
     
    JS(请假等):
    1. function enfocus()
    2. {
    3. var t1 = document.forms[0].DATA_65.value;
    4. var t2 = document.forms[0].DATA_66.value;
    5. var t3 = document.forms[0].DATA_67.value;
    6. var date1 =newDate(t1);
    7. var date2 =newDate(t2);
    8. if(date1.toLocaleDateString()== date2.toLocaleDateString()){
    9. if(date1.getHours()> date2.getHours())
    10. {document.getElementById("DATA_67").value ="error";}
    11. elseif(date1.getHours()<=12&& date2.getHours()>=13)
    12. {document.getElementById("DATA_67").value = date2.getHours()-date1.getHours()-1;}
    13. else
    14. {document.getElementById("DATA_67").value = date2.getHours()-date1.getHours();}
    15. }
    16. elseif(date1.toLocaleDateString()< date2.toLocaleDateString()){
    17. if(date1.getHours()<=12){
    18. date1.setHours(date1.getHours()+1);
    19. }
    20. if(date2.getHours()>=13){
    21. date2.setHours(date2.getHours()-1);
    22. }
    23. var a = date1.toLocaleDateString();
    24. //将时间转换成年月日(去掉小时数)
    25. var a1 =newDate(a);
    26. //将时间转换成标准格式
    27. var time1 = a1.getTime();
    28. //将时间装换成毫秒
    29. var b = date2.toLocaleDateString();
    30. var b1 =newDate(b);
    31. var time2 = b1.getTime();
    32. var firstday;
    33. firstday =18- date1.getHours();
    34. var lastday;
    35. lastday = date2.getHours()-9;
    36. var day;
    37. day =(time2-time1)/86400000-1;
    38. var hours;
    39. hours = firstday + lastday + day*8;
    40. document.getElementById("DATA_67").value = hours;
    41. }
    42. else{document.getElementById("DATA_67").value ="error";}
    43. }
     
    JS(加班):
    1. function enfocus()
    2. {
    3. var t1 = document.forms[0].DATA_65.value;
    4. var t2 = document.forms[0].DATA_66.value;
    5. var t3 = document.forms[0].DATA_67.value;
    6. var date1 =newDate(t1);
    7. var date2 =newDate(t2);
    8. if(date1.toLocaleDateString()== date2.toLocaleDateString()){
    9. if(date1.getHours()< date2.getHours()&& date1.getHours()==18)
    10. {document.getElementById("DATA_67").value = date2.getHours()-date1.getHours()-1;}
    11. elseif(date1.getHours()< date2.getHours()&& date1.getHours()>18)
    12. {document.getElementById("DATA_67").value = date2.getHours()-date1.getHours();}
    13. else
    14. {document.getElementById("DATA_67").value ="error";}
    15. }
    16. elseif(date1.toLocaleDateString()< date2.toLocaleDateString()&&
    17. date1.getHours()>=18&& date2.getHours()<=9){
    18. if(date1.getHours()==18){
    19. date1.setHours(date1.getHours()+1);}
    20. var firstday;
    21. firstday = date1.getHours();
    22. var lastday;
    23. lastday = date2.getHours();
    24. var hours;
    25. hours =24- firstday + lastday;
    26. document.getElementById("DATA_67").value = hours;
    27. }
    28. else{document.getElementById("DATA_67").value ="error";}
    29. }
     





  • 相关阅读:
    Failed at the node-sass@4.13.1 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    页面跳转
    多行文字溢出显示省略号
    iview-select选择器组件的使用&设置默认选中的值
    iview中表单验证(遇到的问题)
    iview DatePicker type 为dateTime 时无法做表单验证!
    报错:[Vue warn]: Error in callback for watcher "value": "Value should be trueValue or falseValue."
    Jquery 数字滚动兼容小数
    validate表单验证-单独验证
    2020软件工程作业03
  • 原文地址:https://www.cnblogs.com/tangbinghaochi/p/6293172.html
Copyright © 2011-2022 走看看