我有一个带有一系列 div 标签的 .aspx 网页。
我将发布其中一个作为我正在做的事情的例子:
<div id="homeownerquestion" runat="server">
Are you the property owner?
<p>
<asp:RadioButtonList ID="RadioButtonHomeowner" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rbHomeOwnerDecision">
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:RadioButtonList>
在页面后面的代码上,我有以下内容:
protected void Page_Load(object sender, EventArgs e)
{
ClientScript.GetPostBackEventReference(this, string.Empty);
if (!IsPostBack)
{
homeownerquestion.Visible = true;
rejection.Visible = false;
HazMap.Visible = false;
WaitList.Visible = false;
k2dlink.Visible = false;
FloodPlain.Visible = false;
floodinterest.Visible = false;
PropertyAge.Visible = false;
older1968.Visible = false;
HomeType.Visible = false;
}
else
{
homeownerquestion.Visible = false;
HazMap.Visible = false;
FloodPlain.Visible = false;
older1968.Visible = false;
HomeType.Visible = false;
}
}
protected void rbHomeOwnerDecision(object sender, EventArgs e)
{
if (RadioButtonHomeowner.SelectedItem.Text == "No")
{
rejection.Visible = true;
k2dlink.Visible = true;
}
if (RadioButtonHomeowner.SelectedItem.Text == "Yes")
{
HazMap.Visible = true;
}
}
这些都是基于单选按钮选择出现和消失的各种 div。
此代码适用于我测试过的每一个浏览器,除了 Explorer 10。我如何强制 IE10 回到 IE 8,因为即使它有效,9 也存在一些显示问题,也欢迎其他建议。