验证时间在给定范围内

时间:2022-07-06 02:52:20
<tr>
  <td height="50"><br>
    <div class=headingbox>Expected Time</div>
    <input  class="textfill" type=time name=DPTime required autofocus
      onfocusout="upperCASE(this)" id=time name=time min="0800" 
      max="1600">
    </div>  
  </td>
</tr>

I am developing a web app for a shop. I want to validate time input so on-line orders can only be placed between 8am and 4pm.

我正在为一家商店开发一个网络应用程序。我想验证时间输入,因此在线订单只能在上午8点到下午4点之间进行。

If an order is made outside this time window I want to present an error message in an alert box.

如果在此时间窗口之外发出订单,我想在警告框中显示错误消息。

1 个解决方案

#1


0  

Try this. You can always compare the strings of date if they are in HH:mm:ss format

试试这个。如果它们是HH:mm:ss格式,您始终可以比较日期字符串

#1


0  

Try this. You can always compare the strings of date if they are in HH:mm:ss format

试试这个。如果它们是HH:mm:ss格式,您始终可以比较日期字符串