我的 JavaScript 知识有限,正在尝试更改表单,以便在选择下拉列表时自动更改,而无需单击执行按钮。
我将如何修改以下代码?那里有3个单独的下拉菜单。我试过插入onselect
那里,但它似乎没有用?
<select name="season">
<option value="0"><?= $txt_all ?></option>
<?php
while($data = mysql_fetch_array($get_seasons))
{
if($data['SeasonID'] == $defaultseasonid)
echo "<option value=\"$data[SeasonID]\" SELECTED>$data[SeasonName]</option>\n";
else
echo "<option value=\"$data[SeasonID]\">$data[SeasonName]</option>\n";
}
mysql_free_result($get_seasons);
?>
</select>
<select name="matchtype">
<option value="0"><?= $txt_all ?></option>
<?php
while($data = mysql_fetch_array($get_types))
{
if($data['MatchTypeID'] == $defaultmatchtypeid)
echo "<option value=\"$data[MatchTypeID]\" SELECTED>$data[MatchTypeName]</option>\n";
else
echo "<option value=\"$data[MatchTypeID]\">$data[MatchTypeName]</option>\n";
}
mysql_free_result($get_types);
?>
</select> <input type="submit" name="submit" value="Go"><td bgcolor="<?php echo $inside_c ?>" align="center">
Other Stats <br><select name="changeto">
<option value="1"><?= $txt_match_statistics ?></option>
<option value="2"><?= $txt_recordbook ?></option>
<option value="5"><?= $txt_opponent_list ?></option>
<option value="6"><?= $txt_this_day ?></option>
</select> <input type="submit" name="changepage" value="Go">