我希望根据NFL时间表,根据时间和日期锁定此下拉菜单中的某些选项。不知道如何隔离每个选项并禁用它们。一个示例或建议将帮助我了解下一步该做什么。谢谢!
<form action="login_success.php" method="POST">
<fieldset>
<legend>Pick</legend>
<select id="tm1" name="teams">
<option value="wr">Washington Redskins</option>
<option value="nyg">New York Giants</option>
<option value="pe">Philadelphia Eagles</option>
<option value="dc">Dallas Cowboys</option>
<option value="br">Baltimore Ravens</option>
<option value="ps">Pittsburgh Steelers</option>
<option value="tt">Tennessee Titans</option>
<option value="gbp">Green Bay Packers</option>
<option value="ss">Seattle Seahawks</option>
<option value="cbr">Cleveland Browns</option>
<option value="bb">Buffalo Bills</option>
<option value="jj">Jacksonville Jaguars</option>
<option value="ic">Indianapolis Colts</option>
<option value="ht">Houston Texans</option>
<option value="kcc">Kansas City Chiefs</option>
<option value="md">Miami Dolphins</option>
<option value="nep">New England Patriots</option>
<option value="nyj">New York Jets</option>
<option value="slr">Saint Louis Rams</option>
<option value="nos">New Orleans Saints</option>
<option value="mv">Minnesota Vikings</option>
<option value="tbb">Tampa Bay Buccaneers</option>
<option value="ac">Arizona Cardinals</option>
<option value="af">Atlanta Falcons</option>
<option value="sf49">San Francisco 49ers</option>
<option value="sdc">San Diego Chargers</option>
<option value="or">Oakland Raiders</option>
<option value="db">Denver Broncos</option>
<option value="cbe">Cincinnati Bengals</option>
<option value="cp">Carolina Panthers</option>
<option value="dl">Detroit Lions</option>
<option value="cbea">Chicago Bears</option>
</select>
<br>
<input type="submit" value="submit">
</fieldset>
</form>
答案 0 :(得分:0)
启用选项:
<option value="ac">Arizona Cardinals</option>
已停用选项:
<option value="ac" disabled>Arizona Cardinals</option>
答案 1 :(得分:0)
您可以使用Me.WindowState = FormWindowState.Maximized
功能获取时间。以下是使用UTC的小时(24小时格式)和分钟的示例。
date()
以下是所有修饰符的列表:PHP date()
然后,您可以执行条件$time = date('G:i');
echo $time;
来呈现您需要的HTML,如果值在特定时间之间,则需要禁用特定选项字段,然后将选项字段呈现为包括if{}
像这样:
disabled
答案 2 :(得分:0)
这或其中的传真将完成基于军事时间的小时禁用选项。您需要调整课程的时间,并根据您如何使用date()
使其更精确。
在该示例中,所有时间都设置为在中午和下午2点之间禁用
<form action="login_success.php" method="POST">
<fieldset>
<legend>Pick</legend>
<select id="tm1" name="teams">
<?php
$tt = date("H");
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="wr"'.$dis.'>Washington Redskins</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="nyg"'.$dis.'>New York Giants</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="pe"'.$dis.'>Philadelphia Eagles</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="dc"'.$dis.'>Dallas Cowboys</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="br"'.$dis.'>Baltimore Ravens</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="ps"'.$dis.'>Pittsburgh Steelers</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="tt"'.$dis.'>Tennessee Titans</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="gbp"'.$dis.'>Green Bay Packers</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="ss"'.$dis.'>Seattle Seahawks</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="cbr"'.$dis.'>Cleveland Browns</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="bb"'.$dis.'>Buffalo Bills</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="jj"'.$dis.'>Jacksonville Jaguars</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="ic"'.$dis.'>Indianapolis Colts</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="ht"'.$dis.'>Houston Texans</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="kcc"'.$dis.'>Kansas City Chiefs</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="md"'.$dis.'>Miami Dolphins</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="nep"'.$dis.'>New England Patriots</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="nyj"'.$dis.'>New York Jets</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="slr"'.$dis.'>Saint Louis Rams</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="nos"'.$dis.'>New Orleans Saints</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="mv"'.$dis.'>Minnesota Vikings</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="tbb"'.$dis.'>Tampa Bay Buccaneers</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="ac"'.$dis.'>Arizona Cardinals</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="af"'.$dis.'>Atlanta Falcons</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="sf49"'.$dis.'>San Francisco 49ers</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="sdc"'.$dis.'>San Diego Chargers</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="or"'.$dis.'>Oakland Raiders</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="db"'.$dis.'>Denver Broncos</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="cbe"'.$dis.'>Cincinnati Bengals</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="cp"'.$dis.'>Carolina Panthers</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="dl"'.$dis.'>Detroit Lions</option>';
if($tt >= 12 && $tt <= 14){$dis = ' disabled';}else{$dis = ''}echo '<option value="cbea"'.$dis.'>Chicago Bears</option>';
?>
</select>
<br>
<input type="submit" value="submit">
</fieldset>
</form>