0

I have "displayNone" class in my HTML, in Jquery I add and remove it and it is working with FF and IE8, but I have problem with IE7 could you help me.

<tr id="tr<%=category %>_1_<% =message.MessageID.ToString() %>" class='<%= (firstCategory ? "" : "displayNone") %>'>
                                    <td id="td<%=category %>_1_1_<% =message.MessageID.ToString() %>" rowspan="2">
                                        <img id="imgEnv<% =message.MessageID.ToString() %>" src='../../Content/Images/envelope_<% =(newMessage ? "closed" : "open") %>.gif'
                                            alt="message" />
                                    </td>                                  
                                    <td class="text-align-right" rowspan="2">
                                        <%= Html.CheckBox("chkMsg", false, new { @value= message.MessageID, @id = string.Format("chkMsg{0}", message.MessageID), @tabindex = "-1" })%>
                                    </td>
                                </tr>



 $('a[id*=lCateg]').click(function() {
                var category = this.id.replace('lCateg', '');
                if ($('#imgCateg' + category).attr('src').indexOf('plus.gif') >= 0) {
                    $('tr[id*=' + category + '_]').removeClass('displayNone');
                    $('#imgCateg' + category).attr('src', $('#imgCateg' + category).attr('src').replace('plus.gif', 'minus.gif'));
                }
4

1 に答える 1

1

.show .hide 関数に組み込まれた jquerys を使用することをお勧めします。このようにして、インライン スタイルが追加され、どのブラウザでも問題は発生しません :)

 $('a[id*=lCateg]').click(function() {
            var category = this.id.replace('lCateg', '');
            if ($('#imgCateg' + category).attr('src').indexOf('plus.gif') >= 0) {
                $('tr[id*=' + category + '_]').show();
                $('#imgCateg' + category).attr('src', $('#imgCateg' + category).attr('src').replace('plus.gif', 'minus.gif'));
            }
于 2012-06-07T16:34:33.917 に答える