日期:2014-05-17 浏览次数:20907 次
<form onsubmit="return check(this)"> 发送日期:<input type="text" name="tempdate" value="2012-10-18" /> 时:<select name="temphour"> <script type="text/javascript"> for (var i = 0; i <= 23; i++) document.write('<option value="' + i + '">' + i + '</option>'); </script> </select> 分<select name="tempminute"> <script type="text/javascript"> for (var i = 0; i <= 59; i++) document.write('<option value="' + i + '">' + i + '</option>'); </script></select> <input type="submit" value="开始发送" /> </form> <script type="text/javascript"> function check(f) { var now = new Date() , arr = f.tempdate.value.split('-')//时间格式我就不验证了,需要自己加 , inputDate = new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(f.temphour.value, 10), parseInt(f.tempminute.value)); if (now >= inputDate) { alert('日历框中的日期必须大于等于服务器系统时间!'); return false; } } </script>