IE7和CSS显示属性

IE7和CSS显示属性,css,internet-explorer-7,Css,Internet Explorer 7,以下是一些asp.net标记: <tr style="display:none" id="AllInRateRow"> <td id="td6"> All-In Fixed Rate <span id="allInRateHelp" /> </td> <td id="t

以下是一些asp.net标记:

<tr style="display:none" id="AllInRateRow">
                    <td id="td6">
                            All-In Fixed Rate <span id="allInRateHelp" />
                    </td>
                    <td id="td7">
                        <%= Html.TextBoxFor(m => m.FixedRate, new { @class = "economicTextBox", propertyName = "FixedRate", dontRegisterNewIndication = true })%> %
                    </td>
                </tr>

                <tr style="display:none" id="ProfitRow">
                    <td id="td93">
                        Your Swap Profit
                    </td>
                    <td id="yourSwapProfit">
                        <%= Html.TextBoxFor(m => m.Fees.ProfitAmount, new { @class = "economicTextBox", propertyName = "Fees.ProfitAmount", dontRegisterNewIndication = true })%>
                            <%= Html.RadioButtonFor(m => m.Fees.ProfitType, (int)Chatham.Enumerations.IndicationProfitType.bps,
                                                    new { label = "bps", propertyName = "Fees.ProfitType", dontRegisterNewIndication = true })%>
                        bps
                        <%= Html.RadioButtonFor(m => m.Fees.ProfitType, (int)Chatham.Enumerations.IndicationProfitType.CurrencyAmount,
                                                                new { label = "$", propertyName = "Fees.ProfitType", dontRegisterNewIndication = true })%>
                        $
                    </td>
                </tr>

全部固定利率
m、 FixedRate,新的{@class=“economicTextBox”,propertyName=“FixedRate”,dontRegisterNewIndication=true})%>%
你的掉期利润
m、 Fees.ProfitAmount,新的{@class=“economicTextBox”,propertyName=“Fees.ProfitAmount”,dontRegisterNewIndication=true})%>
m、 Fees.ProfitType,(int)Chatham.Enumerations.IndicationProfitType.bps,
新建{label=“bps”,propertyName=“Fees.ProfitType”,dontRegisterNewIndication=true})%%>
bps
m、 Fees.ProfitType,(int)Chatham.Enumerations.IndicationProfitType.CurrencyAmount,
新建{label=“$”,propertyName=“Fees.ProfitType”,dontRegisterNewIndication=true})%%>
$
我认为CSS的display属性有问题。它不会在页面加载时显示它们,这是正确的,但如果选择此选项,则应该会改变:

<td id="td4">
                        Options <span id="solverHelper" />
                    </td>
                    <td id="solveType">
                        <%=Html.DropDownListFor(m => m.Fees.CalculationSource, DropDownData.SolverOptionsList(),
                                                                new { propertyName = "Fees.CalculationSource", dontRegisterNewIndication = true })%>
                    </td>

选择权
m、 Fees.CalculationSource,DropDownData.SolverOptionsList(),
新的{propertyName=“Fees.CalculationSource”,dontRegisterNewIndication=true})%>
这些事情是通过JQuery设置CSS并进行如下更改来实现的:

    var pricingOptions = $("#Fees_CalculationSource").val();
            if(pricingOptions == <%= ((int)Chatham.Web.Models.Indications.SwapModel.SolverOptions.AllInRate).ToString() %>)
            {
                $("#AllInRateRow").css("display", "none");
                $("#ProfitRow").css("display", "table-row");
                if(canExcludeFees) $("#IncludeFeesOption").css("display", "table-row");
                else $("#IncludeFeesOption").css("display", "none");

            }
            else if (pricingOptions == <%= ((int)Chatham.Web.Models.Indications.SwapModel.SolverOptions.Profit).ToString() %>)
            {
                $("#AllInRateRow").css("display", "table-row");
                $("#ProfitRow").css("display", "none");
                $("#IncludeFeesOption").css("display", "table-row");
                if(canExcludeFees) $("#IncludeFeesOption").css("display", "table-row");
                else $("#IncludeFeesOption").css("display", "none");

            }
            else if (pricingOptions == <%= ((int)Chatham.Web.Models.Indications.SwapModel.SolverOptions.None).ToString() %>)
            {
                $("#AllInRateRow").css("display", "table-row");
                $("#ProfitRow").css("display", "none");
                $('input[propertyname=Fees.IncludeFeeIndicator]:eq(1)').attr('checked', 'checked');
                $(

"#IncludeFeesOption").css("display", "none");
        }
var pricingOptions=$(“#Fees_CalculationSource”).val();
if(pricingOptions==)
{
$(“#allinratrow”).css(“显示”、“无”);
$(“#ProfitRow”).css(“显示”、“表格行”);
如果(canExcludeFees)$(“#IncludeFeesOption”).css(“显示”、“表格行”);
else$(“#IncludeFeesOption”).css(“显示”、“无”);
}
else if(pricingOptions==)
{
$(“#allinratrow”).css(“显示”、“表格行”);
$(“#ProfitRow”).css(“显示”、“无”);
$(“#IncludeFeesOption”).css(“显示”、“表格行”);
如果(canExcludeFees)$(“#IncludeFeesOption”).css(“显示”、“表格行”);
else$(“#IncludeFeesOption”).css(“显示”、“无”);
}
else if(pricingOptions==)
{
$(“#allinratrow”).css(“显示”、“表格行”);
$(“#ProfitRow”).css(“显示”、“无”);
$('input[propertyname=Fees.IncludeFeeIndicator]:等式(1)'.attr('checked','checked');
$(
“#IncludeFeesOption”).css(“显示”、“无”);
}
我认为IE7无法将CSS设置为table row属性,但它可以处理“none”


我说得对吗?如果我是,有什么解决办法?

如果我回忆正确,IE7使用了
display:block
。显示元素的最简单方法是从jQuery调用show/hide方法,而不是自己控制display属性

$("#AllInRateRow").show();
$("#ProfitRow").hide();
这将适用于所有浏览器,您无需担心浏览器的细节