0 から 23 までの値を選択する 2 つのドロップダウン リストがあります。ユーザーが最初のリストから値を選択すると、2 番目のリストでこの値より低い値を選択できないようにする必要があります。
ここでJavaScriptを介して検証を追加するにはどうすればよいですか? !!
<select name="hourfrom">
<option value="0" @(Request["hourfrom"] == "0" ? " selected=\"selected\"" : "") >0</option>
<option value="1" @(Request["hourfrom"] == "1" ? " selected=\"selected\"" : "") >1</option>
<option value="2" @(Request["hourfrom"] == "2" ? " selected=\"selected\"" : "") >2</option>
<option value="3" @(Request["hourfrom"] == "3" ? " selected=\"selected\"" : "") >3</option>
<option value="4" @(Request["hourfrom"] == "4" ? " selected=\"selected\"" : "") >4</option>
<option value="5" @(Request["hourfrom"] == "5" ? " selected=\"selected\"" : "") >5</option>
<option value="6" @(Request["hourfrom"] == "6" ? " selected=\"selected\"" : "") >6</option>
<option value="7" @(Request["hourfrom"] == "7" ? " selected=\"selected\"" : "") >7</option>
<option value="8" @(Request["hourfrom"] == "8" ? " selected=\"selected\"" : "") >8</option>
<option value="9" @(Request["hourfrom"] == "9" ? " selected=\"selected\"" : "") >9</option>
<option value="10" @(Request["hourfrom"] == "10" ? " selected=\"selected\"" : "") >10</option>
<option value="11" @(Request["hourfrom"] == "11" ? " selected=\"selected\"" : "") >11</option>
<option value="12" @(Request["hourfrom"] == "12" ? " selected=\"selected\"" : "") >12</option>
<option value="13" @(Request["hourfrom"] == "13" ? " selected=\"selected\"" : "") >13</option>
<option value="14" @(Request["hourfrom"] == "14" ? " selected=\"selected\"" : "") >14</option>
<option value="15" @(Request["hourfrom"] == "15" ? " selected=\"selected\"" : "") >15</option>
<option value="16" @(Request["hourfrom"] == "16" ? " selected=\"selected\"" : "") >16</option>
<option value="17" @(Request["hourfrom"] == "17" ? " selected=\"selected\"" : "") >17</option>
<option value="18" @(Request["hourfrom"] == "18" ? " selected=\"selected\"" : "") >18</option>
<option value="19" @(Request["hourfrom"] == "19" ? " selected=\"selected\"" : "") >19</option>
<option value="20" @(Request["hourfrom"] == "20" ? " selected=\"selected\"" : "") >20</option>
<option value="21" @(Request["hourfrom"] == "21" ? " selected=\"selected\"" : "") >21</option>
<option value="22" @(Request["hourfrom"] == "22" ? " selected=\"selected\"" : "") >22</option>
<option value="23" @(Request["hourfrom"] == "23" ? " selected=\"selected\"" : "") >23</option>
</select>
に:
<select name="hourto">
<option value="0" @(Request["hourto"] == "0" ? " selected=\"selected\"" : "") >0</option>
<option value="1" @(Request["hourto"] == "1" ? " selected=\"selected\"" : "") >1</option>
<option value="2" @(Request["hourto"] == "2" ? " selected=\"selected\"" : "") >2</option>
<option value="3" @(Request["hourto"] == "3" ? " selected=\"selected\"" : "") >3</option>
<option value="4" @(Request["hourto"] == "4" ? " selected=\"selected\"" : "") >4</option>
<option value="5" @(Request["hourto"] == "5" ? " selected=\"selected\"" : "") >5</option>
<option value="6" @(Request["hourto"] == "6" ? " selected=\"selected\"" : "") >6</option>
<option value="7" @(Request["hourto"] == "7" ? " selected=\"selected\"" : "") >7</option>
<option value="8" @(Request["hourto"] == "8" ? " selected=\"selected\"" : "") >8</option>
<option value="9" @(Request["hourto"] == "9" ? " selected=\"selected\"" : "") >9</option>
<option value="10" @(Request["hourto"] == "10" ? " selected=\"selected\"" : "") >10</option>
<option value="11" @(Request["hourto"] == "11" ? " selected=\"selected\"" : "") >11</option>
<option value="12" @(Request["hourto"] == "12" ? " selected=\"selected\"" : "") >12</option>
<option value="13" @(Request["hourto"] == "13" ? " selected=\"selected\"" : "") >13</option>
<option value="14" @(Request["hourto"] == "14" ? " selected=\"selected\"" : "") >14</option>
<option value="15" @(Request["hourto"] == "15" ? " selected=\"selected\"" : "") >15</option>
<option value="16" @(Request["hourto"] == "16" ? " selected=\"selected\"" : "") >16</option>
<option value="17" @(Request["hourto"] == "17" ? " selected=\"selected\"" : "") >17</option>
<option value="18" @(Request["hourto"] == "18" ? " selected=\"selected\"" : "") >18</option>
<option value="19" @(Request["hourto"] == "19" ? " selected=\"selected\"" : "") >19</option>
<option value="20" @(Request["hourto"] == "20" ? " selected=\"selected\"" : "") >20</option>
<option value="21" @(Request["hourto"] == "21" ? " selected=\"selected\"" : "") >21</option>
<option value="22" @(Request["hourto"] == "22" ? " selected=\"selected\"" : "") >22</option>
<option value="23" @(Request["hourto"] == "23" ? " selected=\"selected\"" : "") >23</option>
</select>