• JS显示隐藏节点


    <tr>
      <td class="emBold"><font color="#FF0000">*</font> State:</td>
      

      <td>
        <asp:DropDownList ID="ddlState" runat="server" onchange="CheckState()"/>
        <asp:RequiredFieldValidator ID="rfvState" runat="server" ErrorMessage="The State is required" ControlToValidate="ddlState"/>
      </td>
    </tr>

    //ID为"rfvState"的父节点的上一个兄弟节点的第一个子节点,即红色星号*显示

    document.getElementById("rfvState").parentElement.previousElementSibling.firstChild.style.visibility = "visible";

    //ID为"rfvState"的父节点的上一个兄弟节点的第一个子节点,即红色星号*隐藏
    document.getElementById("rfvState").parentElement.previousElementSibling.firstChild.style.visibility = "hidden";

    document.getElementById("rfvState").parentElement.previousElementSibling.firstChild.style.display = "block";

    document.getElementById("rfvState").parentElement.previousElementSibling.firstChild.style.display = "inline-block";

    //将<font>节点样式全部隐藏,即红色星号*和占位的空白都删除,State会最靠左顶格显示

    document.getElementById("rfvState").parentElement.previousElementSibling.firstChild.style.display = "none";

    var St = "";
    function CheckState() {
    St = document.getElementById("ddlState").value;
    }

    function CheckCountry() {
    if (document.getElementById("ddlCountry").value == "USA") {
    document.getElementById("ddlState").value = St;
    PackageinfoValidatorsStAndZip(true);
    document.getElementById("rfvState").parentElement.previousElementSibling.firstChild.style.visibility = "visible";
    document.getElementById("rfvZipCode").parentElement.previousElementSibling.firstChild.style.visibility = "visible";
    } else {
    document.getElementById("ddlState").value = "";
    PackageinfoValidatorsStAndZip(false);
    document.getElementById("rfvState").parentElement.previousElementSibling.firstChild.style.visibility = "hidden";
    document.getElementById("rfvZipCode").parentElement.previousElementSibling.firstChild.style.visibility = "hidden";
    }

  • 相关阅读:
    如何解决"应用程序无法启动,因为应用程序的并行配置不正确"问题
    C/C++时间函数使用方法
    vim: C++文件之间快速切换(含视频)
    HOWTO install commonlisp on ubuntu
    TagSoup home page
    Quicklisp beta
    What is Lispbox?
    猫人女王
    Lisp in a box 安装指南 JAAN的专栏 博客频道 CSDN.NET
    Ubuntu 12.04 改造指南 | Ubuntusoft
  • 原文地址:https://www.cnblogs.com/HuairongChen/p/13403158.html
Copyright © 2020-2023  润新知