如何使用"old"(HTML5 之前)HTML 控制 html 选择元素中的可见项?



i具有HTML选择元素,该元素基于其他地方的值集,应该显示两对值之一。在一种情况下,应该是"新"one_answers"假设",而在另一个情况下,则应该是"现有"one_answers"有机增长"

因此,目前我正在与所有这些人一起创建它,例如:

<tr>
    <td nowrap align="left" valign="top">
      <font color="<%=Session("TextColor")%>" style="font: 8pt arial">Subcategory:&nbsp;</font>  
        </td>
    <td nowrap align="left" valign="top">
    <select name="subcategory" color="<%=Session("TextColor")%>" style="font: 8pt arial" onchange="UpdateFlag=true;">
      <option value="3">Organic Growth
      <option value="2">Existing
      <option value="1">Assumed
      <option value="0">New
    </select>
    </td>
</tr>   

,但我只想根据isnewBusiness的值一次显示其中两个值:

Dim IsNewBusiness As Boolean

...之后:

currentYear = Year(Now)
SQLString = "Select NewBiz from MasterUnitsprojSales where CYear = " & currentYear & " and Unit = '" & Unit & "'"
adoRS.Open(SQLString, adoCon)
IsNewBusiness = TRUE 'default (if record not found)
If Not adoRS.EOF Then
    IsNewBusiness = adoRS.Fields.Item(0).Value <> 0
End If
adoRS.Close()

知道iSnewBusiness的价值,如何可见html选择中的哪一对项目?我可以添加一些"内联" JavaScript或其他内容?

我会把javascript删除:

<tr>
    <td nowrap align="left" valign="top">
      <font color="<%=Session("TextColor")%>" style="font: 8pt arial">Subcategory:&nbsp;</font>  
        </td>
    <td nowrap align="left" valign="top">
    <select name="subcategory" color="<%=Session("TextColor")%>" style="font: 8pt arial" onchange="UpdateFlag=true;">
<% if not isNewbusienss then %>
      <option value="3">Organic Growth
      <option value="2">Existing
<% else %>
      <option value="1">Assumed
      <option value="0">New
<% end if %>
    </select>
    </td>
</tr>

注意:我的vbscript非常生锈,所以您可能需要熨除一些错误

最新更新