带循环的下拉菜单选择

发布于 2024-09-19 20:46:14 字数 435 浏览 1 评论 0原文

我正在创建 2 个下拉菜单,其中第一个是开始时间,例如上午 8:00,它使用循环来生成时间,这工作正常,下拉菜单具有所需的时间范围,现在我需要创建一个脚本如果开始时间大于结束时间并且我有这个,则返回为 false:

var conting_timefrom=frm_conting.timefrom.value;  
 if(isNaN(conting_timefrom)){alert("You need to enter a starting time.");return false;}; 
 if(conting_timefrom.value>conting_timeto.value){alert("The time you have entered is after the finish time.");return false;}; 

但是这不起作用,有任何线索吗?

I am creating 2 drop down menus where the first is a start time, e.g. 8:00 am which uses a loop to generate the times, this works fine and the drop down menu has the desired time frames, now i need to create a script which returns as false if the start time is greater than the finish time and i have this:

var conting_timefrom=frm_conting.timefrom.value;  
 if(isNaN(conting_timefrom)){alert("You need to enter a starting time.");return false;}; 
 if(conting_timefrom.value>conting_timeto.value){alert("The time you have entered is after the finish time.");return false;}; 

however this doesn't work, any clues?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失退 2024-09-26 20:46:18
  1. 在所有菜单中选择时间时绑定事件,
  2. 在此事件处理函数中,
  3. 如果其中之一 ==“”,则获取所有时间字段的值。警告此
  4. 按小时和分钟分割值 (.split('')) 并以整数表示 ("10" < "2")
  5. value = 小时 * 60 + 分钟 ....
  6. 如果值1 <值 2 返回 true - 否则警报并返回 false
  1. bind event on selectind time in all menus
  2. im this eventhandlers functions get values of all time fields
  3. if one of them == "". alert this
  4. split values on hours and minutes (.split('')) and make in integers ("10" < "2")
  5. value = hours * 60 + minutes ....
  6. if value 1 < value 2 return true - else alert and return false
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文