Results 1 to 2 of 2

Thread: get minutes from selected hours

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    get minutes from selected hours

    i have following code for users to select hours.
    its only for 1 to 12 hours format
    all fields are dropdown

    startHour : startMinutes : finishHour : finishMinutes : AM/PM

    i want to validate with javascript that user can only select correct time. And calculate the minutes of selected hours from dropdown menus.
    example

    2:00 To 6:00 PM
    3:15 To 4:45 PM
    11:00(AM) To 2:00 PM

    here is the code for my html

    Code:
            	<table border="1" cellpadding="5" cellspacing="0" align="center">
                	<tr>
    					<td>Start Time</td>
    					<td>Finish Time</td>
    					<td>AM/PM</td>
    					<td>&nbsp;</td>
                    </tr>
                	<tr>
    					<td>
    						<select id="cbo_start_hour" name="cbo_start_hour">
    							<option value="-1">Hour</option>
    							<option>1</option>
    							<option>2</option>
    							<option>3</option>
    							<option>4</option>
    							<option>5</option>
    							<option>6</option>
    							<option>7</option>
    							<option>8</option>
    							<option>9</option>
    							<option>10</option>
    							<option>11</option>
    							<option>12</option>
    						</select>
    						<select id="cbo_start_minute" name="cbo_start_minute">
    							<option value="-1">Minute</option>
    							<option>00</option>
    							<option>15</option>
    							<option>30</option>
    							<option>45</option>
    						</select>
    					</td>
    					<td>
    						<select id="cbo_finish_hour" name="cbo_finish_hour">
    							<option value="-1">Hour</option>
    							<option>1</option>
    							<option>2</option>
    							<option>3</option>
    							<option>4</option>
    							<option>5</option>
    							<option>6</option>
    							<option>7</option>
    							<option>8</option>
    							<option>9</option>
    							<option>10</option>
    							<option>11</option>
    							<option>12</option>
    						</select>
    						<select id="cbo_finish_minute" name="cbo_finish_minute">
    							<option value="-1">Minute</option>
    							<option>00</option>
    							<option>15</option>
    							<option>30</option>
    							<option>45</option>
    						</select>
    					</td>
    					<td>
    						<select id="cbo_am_pm" name="cbo_am_pm">
    							<option value="-1">AM/PM</option>
    							<option>AM</option>
    							<option>PM</option>
    						</select>
    					</td>
    					<td>
    						<input type="button" value="Start Time" onClick="start_time()" class="btn_submit">
    					</td>					
                    </tr>
    				
                </table>
    Last edited by chunk; Dec 25th, 2012 at 01:37 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width