cron表达式
Posted 艺术家
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cron表达式相关的知识,希望对你有一定的参考价值。
dd
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="keywords" content="Cron by NilsZhang" /> <title>CronMaker</title> <script> function getExp() { var mycron = "-1"; nowdisplay = document.getElementById("nowdisplay").value; if(nowdisplay == "Minutes") { txtMinutes = document.getElementById("txtMinutes").value; hourPart = document.getElementById("hourPart").value; minutePart = document.getElementById("minutePart").value; mycron = "0 "+minutePart+"/"+txtMinutes+" "+hourPart+"/1 * * ?"; } else if(nowdisplay == "Hourly") { txtHourly = document.getElementById("txtHourly").value; hourPart = document.getElementById("hourPart").value; minutePart = document.getElementById("minutePart").value; mycron = "0 "+minutePart+" "+hourPart+"/"+txtHourly+" * * ?"; } else if(nowdisplay == "Daily") { txtDaily = document.getElementById("txtDaily").value; hourPart = document.getElementById("hourPart").value; minutePart = document.getElementById("minutePart").value; mycron = "0 "+minutePart+" "+hourPart+" 1/"+txtDaily+" * ?"; } else if(nowdisplay == "Weekly") { var week = ""; var huang = document.all[\'txtWeekly\']; for(i = 0;i < huang.length;i++){ if(huang[i].checked == true) { week = week+huang[i].value+","; } } if(week.length==0) { alert(" 必须选择日期!"); return; } week = week.substring(0,week.length-1); hourPart = document.getElementById("hourPart").value; minutePart = document.getElementById("minutePart").value; mycron = "0 "+minutePart+" "+hourPart+" ? * "+week+" * "; } else if(nowdisplay == "Monthly") { ChoiceMonth=document.getElementById("ChoiceMonth").value; ChoiceDay=document.getElementById("ChoiceDay").value; hourPart = document.getElementById("hourPart").value; minutePart = document.getElementById("minutePart").value; mycron = "0 "+minutePart+" "+hourPart+" "+ChoiceDay+" 1/"+ChoiceMonth+" ? * "; } if(mycron != "-1") { document.getElementById("task_schedule").value =mycron ; } } function display(nowdisplay) { cronThis = document.getElementById("nowdisplay").value; if(nowdisplay!=cronThis) { document.getElementById(cronThis).style.display = "none"; document.getElementById(nowdisplay).style.display = "block"; document.getElementById("nowdisplay").value = nowdisplay; } document.getElementById("task_schedule").value ="" ; } </script> </head> <body> <div> <input type="hidden" id="nowdisplay" value="Daily"> <button id ="MinutesTab" onClick="display(\'Minutes\')" type="button" class="btn btn-default" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">按分钟</button> <button id ="HourlyTab" onClick="display(\'Hourly\')" type="button" class="btn btn-default" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">按小时</button> <button id ="DailyTab" onClick="display(\'Daily\')" type="button" class="btn btn-default" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">按天</button> <button id ="WeeklyTab" onClick="display(\'Weekly\')" type="button" class="btn btn-default" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">按周</button> <button id="MonthlyTab" onClick="display(\'Monthly\')" type="button" class="btn btn-default" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">按月</button> <div class="collapse" id="collapseExample"> <div class="well"> <div class="form-group" id="Daily"> <label for="disabledSelect" class="col-sm-2 control-label text-right">运行频率:</label> <div class="col-sm-3"> <input type="text" value="1" name="txtDaily" id="txtDaily" class="form-control"/> </div> <label for="disabledSelect" class="col-sm-2 control-label text-left"> 天/次</label> <div class="col-sm-5"></div> </div> <div class="form-group" id="Monthly" style="display:none"> <label for="disabledSelect" class="col-sm-2 control-label text-right">运行频率:</label> <label for="disabledSelect" class="col-sm-1 control-label text-left">每</label> <div class="col-sm-3"> <input type="text" value="1" name="ChoiceMonth" id="ChoiceMonth" class="form-control"/> </div> <label for="disabledSelect" class="col-sm-1 control-label text-left">个月的第</label> <div class="col-sm-3"> <input type="text" value="1" name="ChoiceDay" id="ChoiceDay" class="form-control"/> </div> <label for="disabledSelect" class="col-sm-1 control-label text-left">天</label> </div> <div class="form-group" id="Hourly" style="display:none"> <label for="disabledSelect" class="col-sm-2 control-label text-right">运行频率:</label> <div class="col-sm-3"> <input type="text" value="1" name="txtHourly" id="txtHourly" class="form-control"/> </div> <label for="disabledSelect" class="col-sm-2 control-label text-left"> 时/次</label> <div class="col-sm-5"></div> </div> <div class="form-group" id="Weekly" style="display:none"> <label for="disabledSelect" class="col-sm-2 control-label text-right">指定日期:</label> <div class="col-sm-10"> <div class="checkbox-inline"> <label> <input type="checkbox" id="id42" name="txtWeekly" value="2" />周一 </label> </div> <div class="checkbox-inline"> <label> <input type="checkbox" id="id43" name="txtWeekly" value="3" /> 周二 </label> </div> <div class="checkbox-inline"> <label> <input type="checkbox" id="id44" name="txtWeekly" value="4" /> 周三 </label> </div> <div class="checkbox-inline"> <label> <input type="checkbox" id="id45" name="txtWeekly" value="5" />spring cron表达式