简体   繁体   中英

Drop down menu selection with loop

I am creating 2 drop down menus where the first is a start time, eg 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?

  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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM