为什么我的 html select 元素没有显示在页面上?

Why does my html select element not display on the page?

我尝试将 dropdown/select 元素添加到页面,如下所示:

<select name="subcategory" color="#000000" style="font: 8pt arial" onchange="UpdateFlag=true;">
    <option  value="3">Eastern
    <option  value="2">Central
    <option  value="1">Mountain
    <option  selected value="0">Pacific
</select>

(值(Eastern 等)目前是伪造的占位符 - 我只是一次迈出这一步,第一步是看看它是否会显示在页面上 - 它不会.

html table 的最后一部分是:

    <td nowrap align="left" valign="top">
        <select name="TimeZone" color="#000000" style="font: 8pt arial" onchange="UpdateFlag=true;">
            <option  value="3">Eastern
            <option  value="2">Central
            <option  value="1">Mountain
            <option  selected value="0">Pacific
        </select>
        <font color="#000000" style="font: 8pt arial">&nbsp;&nbsp;&nbsp;</font>
        <font color="#000000" style="font: 8pt arial">Cut-Off Times&nbsp;</font>
        <font color="#000000" style="font: 8pt arial">Same Day:&nbsp;</font>
        <input name="CutOffTimeSD" type="text" style="font: 8pt arial" size="1" maxlength="5" onfocus="this.select();" onchange="UpdateFlag=true;" value="     ">
        <font color="#000000" style="font: 8pt arial">&nbsp;&nbsp;&nbsp;</font>
        <font color="#000000" style="font: 8pt arial">Next Day:&nbsp;</font>
        <input name="CutOffTime" type="text" style="font: 8pt arial" size="1" maxlength="5" onfocus="this.select();" onchange="UpdateFlag=true;" value="10:00">
    </td>
</tr>
<tr>
    <td nowrap align="left" valign="top">
        <font color="#000000" style="font: 8pt arial">Options:&nbsp;</font>
    </td>
    <td nowrap align="left" valign="top">
        <input name="SurveyFlag" type="checkbox" style="font: 8pt arial" size="1" maxlength="1" onfocus="this.select();" onchange="UpdateFlag=true;" value="-1" >
        <font color="#000000" style="font: 8pt arial">Participate in online surveys&nbsp;</font>
    </td>
</tr>
<tr>
    <td nowrap align="left" valign="top">
        <font color="#000000" style="font: 8pt arial">Email:&nbsp;</font>
    </td>
    <td nowrap align="left" valign="top">
        <input name="Email" type="text" style="font: 8pt arial" size="100" maxlength="100" onfocus="this.select();" onchange="UpdateFlag=true;" value="">
    </td>
</tr>   
    <tr>
        <select name="subcategory" color="#000000" style="font: 8pt arial" onchange="UpdateFlag=true;">
            <option  value="3">Eastern
            <option  value="2">Central
            <option  value="1">Mountain
            <option  selected value="0">Pacific
        </select>
    </tr>               
</table>

上面的代码是在页面显示时从页面中提取的(通过上下文 "View Source" 菜单项)。

那么为什么 "subcategory" 下拉列表不显示?电子邮件标签和右侧的长文本框是最后可见的内容,即使 htmlselect 应该出现在其下方,基于 html.

您缺少 <td> 标签。

尝试

<tr>
  <td>
    <select name="subcategory" color="#000000" style="font: 8pt arial" onchange="UpdateFlag=true;">
        <option  value="3">Eastern
        <option  value="2">Central
        <option  value="1">Mountain
        <option  selected value="0">Pacific
    </select>
  </td>
</tr>