【问题标题】:Show/hide the content of the app based on a yes/no dropdown根据是/否下拉显示/隐藏应用程序的内容
【发布时间】:2017-08-21 20:35:41
【问题描述】:

在应用程序的开头,有一个是/否下拉菜单。如果选择“否”,则其余代码不应运行,下拉菜单后屏幕上不应出现任何内容。如果选择“是”,之后编写的代码(此处未显示)应该运行。有没有办法做到这一点?

<table>
    <tr><td colspan="3" align="center" bgcolor="#FF8000"><h2>Solicitud de Vendedor Honorario</h2></td></tr>
    <tr><td colspan="3" align="center" bgcolor="#D4D4D4">Adiestramiento</td></tr>
    <tr>
      <td colspan="3" align="center" bgcolor="#1B4F72">
        <select id="yesno" size="1">
      <option value="yes">Yes</option>
      <option value="no">No</option>
        </select>
      </td>
    </tr>  

【问题讨论】:

  • 你研究过共享偏好吗?您可以在代码的最开头应用 if 语句。如果为 1,则执行代码,如果为 0,则不执行任何操作。

标签: android html show-hide


【解决方案1】:

一旦您获得下拉列表的值,只需将要隐藏的任何元素的 css display 属性设置为 none

例如。

display: none;

【讨论】:

    猜你喜欢
    • 2020-12-02
    • 1970-01-01
    • 1970-01-01
    • 2011-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-04
    • 2012-08-06
    相关资源
    最近更新 更多