• 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";
    }

  • 相关阅读:
    ActiveMQ-在Centos7下安装和安全配置
    Servlet基础知识点
    Filter的执行顺序
    Dubbo-使用Maven构建Dubbo服务的可执行jar包
    Dubbo-Centos7管控台安装
    Spring 小知识点
    Zookeeper+ActiveMQ集群搭建
    Zookeeper在Centos7上搭建单节点应用
    SpringMVC+AJAX+JSON
    RocketMQ-Filer
  • 原文地址:https://www.cnblogs.com/HuairongChen/p/13403158.html
Copyright © 2020-2023  润新知