标签:style display element stat fir 技术 drop none 图片
<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";
标签:style display element stat fir 技术 drop none 图片
原文地址:https://www.cnblogs.com/HuairongChen/p/13403158.html