Home  >  Article  >  Web Front-end  >  Use RadioButten or CheckBox to display and hide divs_javascript skills

Use RadioButten or CheckBox to display and hide divs_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:22:031348browse

When "Female" is selected, "Beauty, Talented Woman" is displayed; when "Male" is selected, the aspx page content is hidden:

Copy code The code is as follows:


Use RadioButten (or CheckBox) to display and hide div





Male
Female
<%-- Female--%>





cs page code:
Copy the code The code is as follows:

protected void Page_Load(object sender, EventArgs e)
{
this.Radio2.Checked = true;
if (this.Radio2.Checked)
this.nvInfo.Attributes.CssStyle.Add("display", "block"); //Add CSS style attributes from .cs to the HTML control in .aspx
if (this.Radio1.Checked)
this.nvInfo.Attributes.CssStyle.Add("display", "none"); //Add CSS style attributes from .cs to the HTML control in .aspx
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn