zoukankan      html  css  js  c++  java
  • 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";
    }

  • 相关阅读:
    beta分布
    python中os.walk浏览目录和文件
    (zz)Linux下Gcc生成和使用静态库和动态库详解
    GNU scientific library
    python 字典有序无序及查找效率,hash表
    Python代码分析工具之dis模块
    python里的坑。http://www.pythoner.com/356.html
    python实现单向链表
    Python 执行字符串表达式函数(eval exec execfile)
    版本管理神器git上手
  • 原文地址:https://www.cnblogs.com/HuairongChen/p/13403158.html
Copyright © 2011-2022 走看看