我已将24小时分为12个部分
(12:00AM to 02:00Am,
02:00AM to 04:00AM,
04:00AM to 06:00AM,
06:00AM to 08:00AM,
08:00AM to 10:00AM,
10:00Am to 12:00PM,
12:00PM to 02:00pm,
02:00pm to 04:00pm,
04:00pm to 06:00pm,
06:00pm to 08:00pm,
08:00pm to 10:00pm,
10:00pm to 12:00pm)
如果在(12:00Am到02:00 AM)文本框中插入了值,它应该用系统时间检查时间是12到2am,如果是这样的话它允许插入记录。反之,对于所有字段如何实施
答案 0 :(得分:0)
你的HTML应该是这样的:
<h3>Current time is 5:56pm</h3>
<form>
<fieldset>
<legend>Time intervals:</legend>
...<br />
2:00pm - 4:00pm:
<input type="text" disabled><br>
4:00pm - 6:00pm:
<input type="text"><br>
6:00pm - 8:00pm:
<input type="text" disabled><br>
8:00pm - 10:00pm:
<input type="text" disabled><br>
...
</fieldset>
</form>
创建一个JavaScript函数,该函数将禁用与当前时间不对应的输入。